27 #include <Classes.hpp>
28 #include <Controls.hpp>
29 #include <StdCtrls.hpp>
31 #include <Buttons.hpp>
32 #include <ExtCtrls.hpp>
34 #include <Dialogs.hpp>
35 #include <Graphics.hpp>
36 #include <ComCtrls.hpp>
37 #include <Clipbrd.hpp>
61 #include <Filectrl.hpp>
64 #include <Vcl.HTMLHelpViewer.hpp>
65 #pragma package(smart_init)
66 #pragma link "Vcl.HTMLHelpViewer" //added at v2.0.0 for access to the .chm help file
67 #pragma resource "*.dfm"
87 Screen->Cursor = TCursor(-11);
100 CurDir = AnsiString(GetCurrentDir());
102 UnicodeString FullProgramName = GetModuleName(0);
104 UnicodeString ProgramName = ExtractFileName(FullProgramName);
106 UnicodeString ProgramDirectoryName = ExtractFilePath(FullProgramName);
109 if(!FileExists(ProgramName))
111 if(!SetCurrentDir(ProgramDirectoryName))
113 ShowMessage(
"The working directory does not contain the railway executable file so the program cannot "
114 "open. This is usually because the program has been selected via the right-click taskbar icon though it may "
115 "also happen in other circumstances. It is caused by the Windows operating system re-assigning the "
116 "working directory for some unknown reason, though whether or not it happens appears to depend on the "
117 "Windows update version.\n\n"
118 "To avoid this happening please open the program by double clicking the program icon on the desktop "
119 "if there is one, or the program icon shown in Windows Explorer.");
120 Application->Terminate();
124 CurDir = AnsiString(GetCurrentDir());
182 "program operation will be restricted");
184 Application->HelpFile = AnsiString(
CurDir +
"\\Help.chm");
192 int DispW = (Screen->Width - 64) / 16;
193 int DispH = (Screen->Height - 192) / 16;
197 Display =
new TDisplay(
MainScreen,
PerformanceLogBox,
OutputLog1,
OutputLog2,
OutputLog3,
OutputLog4,
OutputLog5,
OutputLog6,
OutputLog7,
OutputLog8,
270 std::ifstream ConfigFile((
CurDir +
"\\Config.txt").c_str());
271 if(ConfigFile.fail())
274 SigImagePanel->Caption =
"Signals will be on the left hand side of the track";
280 "This program is free software released under the terms of the GNU General Public License Version 3, as published by the Free Software Foundation. " "It may be used or redistributed in accordance with that license and is released in the hope that it will be useful, but WITHOUT ANY WARRANTY; "
281 "without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details - " "you should have received a copy along with this program but if not see <http://www.gnu.org/licenses/>."
286 AnsiString ConfigStr =
"";
294 AnsiString ConfigValue = ConfigStr.SubString(9, ConfigStr.Length() - 8);
295 if(ConfigStr.SubString(1, 8) ==
"Signals=")
297 if(ConfigValue ==
"right")
309 SigImagePanel->Caption =
"Signals will be on the right hand side of the track";
318 SigImagePanel->Caption =
"Signals will be on the left hand side of the track";
325 if(ConfigStr.SubString(1, 8) ==
"BgndCol=")
329 if(ConfigValue ==
"white")
333 else if(ConfigValue ==
"blue")
338 if(ConfigStr.SubString(1, 8) ==
"RLYLocn=")
340 if(DirectoryExists(ConfigValue))
346 else if(ConfigStr.SubString(1, 8) ==
"TTBLocn=")
348 if(DirectoryExists(ConfigValue))
350 TimetableDialog->InitialDir = ConfigStr.SubString(9, ConfigStr.Length() - 8);
351 SaveTTDialog->InitialDir = ConfigStr.SubString(9, ConfigStr.Length() - 8);
354 else if(ConfigStr.SubString(1, 8) ==
"SSNLocn=")
356 if(DirectoryExists(ConfigValue))
362 while(!ConfigFile.eof());
459 SpeedButton96->Glyph->LoadFromResourceName(0,
"ConcourseGlyph");
523 FontButton->Glyph->LoadFromResourceName(0,
"FontGraphic");
524 HomeButton->Glyph->LoadFromResourceName(0,
"Home");
543 SetGapsButton->Glyph->LoadFromResourceName(0,
"ConnectGaps");
555 CallOnImage->Picture->Bitmap->LoadFromResourceName(0,
"CallingOn");
556 CrashImage->Picture->Bitmap->LoadFromResourceName(0,
"CrashWarning");
557 DerailImage->Picture->Bitmap->LoadFromResourceName(0,
"DerailWarning");
558 SignalStopImage->Picture->Bitmap->LoadFromResourceName(0,
"SignalStopWarning");
559 SPADImage->Picture->Bitmap->LoadFromResourceName(0,
"SPADWarning");
560 TrainFailedImage->Picture->Bitmap->LoadFromResourceName(0,
"TrainFailedWarning");
561 ManualLCDownImage->Picture->Bitmap->LoadFromResourceName(0,
"ManualLCDownImage");
563 DistanceKey->Picture->Bitmap->LoadFromResourceName(0,
"DistanceKey");
564 PrefDirKey->Picture->Bitmap->LoadFromResourceName(0,
"PrefDirKey");
566 TrackLinkedImage->Picture->Bitmap->LoadFromResourceName(0,
"TrackLinkedGraphic");
568 GapsNotSetImage->Picture->Bitmap->LoadFromResourceName(0,
"GapsNotSetGraphic");
569 GapsSetImage->Picture->Bitmap->LoadFromResourceName(0,
"GapsSetGraphic");
580 AnsiString NL =
'\n';
581 const AnsiString TTLabelStr1 =
"Start new train" + NL +
"Start new service from a split" + NL +
"Start new service from another service" + NL +
582 "Start new non-repeating shuttle finish service" + NL +
"Start new shuttle train at a timetabled stop" + NL +
583 "Start new shuttle service from a feeder";
585 const AnsiString TTLabelStr2 =
"Pass" + NL +
"Be joined by another train" + NL +
"Front split" + NL +
"Rear split" + NL +
"Change direction of train";
587 const AnsiString TTLabelStr3 =
"Finish && form a new service" + NL +
"Finish && join another train" + NL +
"Finish && exit railway" + NL +
588 "Finish && repeat shuttle, finally remain here" + NL +
"Finish && repeat shuttle, finally form a finishing service" + NL +
589 "Finish non-repeating shuttle feeder service" + NL +
"Finish && remain here";
591 const AnsiString TTLabelStr4 =
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
592 "HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
" " +
595 const AnsiString TTLabelStr5 =
"HH:MM ';' Location" + NL +
"HH:MM ';' HH:MM ';' Location";
597 const AnsiString TTLabelStr6 =
"+ rear element ID - space - front element ID [+ optional ';S']" + NL +
"+ ref. of the train that splits" + NL +
598 "+ other service ref." + NL +
"+ shuttle service ref." + NL +
"+ rear element ID - space - front element ID ';' linked shuttle ref." + NL +
599 "+ linked shuttle service ref. ';' feeder service ref." + NL +
"+ location" + NL +
"+ joining train ref." + NL +
"+ new service ref." + NL +
600 "+ new service ref." + NL +
" " + NL +
"+ new service ref." + NL +
"+ ref. of train to join" + NL +
601 "+ list of valid exit element IDs (at least 1) separated by spaces" + NL +
"+ linked shuttle service ref.";
603 const AnsiString TTLabelStr7 =
"Arrival OR departure time (program will determine which from the context) + location." + NL +
604 "Arrival time, departure time (with no events between) + location";
606 const AnsiString TTLabelStr9 =
"Timetable entries" + NL +
"(service references etc.)";
607 const AnsiString TTLabelStr11 =
"Timetable" + NL +
"start time";
609 const AnsiString TTLabelStr12 =
"NB: WITHIN SERVICES commas must" + NL +
"not be used (have special meanings)," + NL +
610 "and semicolons may only be used to" + NL +
"separate service components.";
612 const AnsiString TTLabelStr13 =
"+ linked shuttle service ref. ';' finishing service ref." + NL +
"+ linked shuttle service ref.";
614 const AnsiString TTLabelStr15 =
"Repeat the service + ';' minutes between repeats ';' digit increment ';' number of repeats (last line of service)";
637 if((Screen->Width < 1024) || (Screen->Height < 768))
639 ShowMessage(
"Please note that this program works best with a screen resolution of at least 1024 x 768. Please change if possible");
644 WindowState = wsMaximized;
656 Screen->Cursor = TCursor(-2);
694 char *LocalNumericInformation = setlocale(LC_NUMERIC,
"");
696 if(LocalNumericInformation ==
"")
701 struct lconv *conv = &Locale;
707 catch(
const EFOpenError &e)
711 MessageDlg(e.Message +
" - program must terminate", mtError, But, 0);
712 Application->Terminate();
715 catch(
const Exception &e)
719 AnsiString Message =
"A fatal error occurred during the program setup process, the program must terminate. Message = " + e.Message;
720 MessageDlg(Message, mtError, But, 0);
722 Application->Terminate();
734 AnsiString ColourStr =
"", SignalStr =
"";
735 remove((
CurDir +
"\\Config.txt").c_str());
736 std::ofstream ConfigFile((
CurDir +
"\\Config.txt").c_str());
751 ConfigFile << AnsiString(
"Signals=") << SignalStr <<
'\n';
752 ConfigFile << AnsiString(
"BgndCol=") << ColourStr <<
'\n';
753 ConfigFile << AnsiString(
"RLYLocn=") << AnsiString(
LoadRailwayDialog->InitialDir) <<
'\n';
754 ConfigFile << AnsiString(
"TTBLocn=") << AnsiString(
TimetableDialog->InitialDir) <<
'\n';
755 ConfigFile << AnsiString(
"SSNLocn=") << AnsiString(
LoadSessionDialog->InitialDir) <<
'\n';
779 catch(
const Exception &e)
796 catch(
const Exception &e)
817 Screen->Cursor = TCursor(-2);
827 Screen->Cursor = TCursor(-2);
835 catch(
const Exception &e)
854 catch(
const Exception &e)
867 UnicodeString strVersion = L
"N/A";
869 VersionSize = GetFileVersionInfoSizeW(Application->ExeName.c_str(), &VersionHandle);
872 pBuffer =
new BYTE[VersionSize];
874 if(GetFileVersionInfoW(Application->ExeName.c_str(), VersionHandle, VersionSize, pBuffer))
876 VS_FIXEDFILEINFO *fi;
880 if(VerQueryValueW(pBuffer, L
"\\", (
void**)&fi, &buflen))
883 strVersion.sprintf(L
"%d.%d.%d", HIWORD(fi->dwFileVersionMS), LOWORD(fi->dwFileVersionMS), HIWORD(fi->dwFileVersionLS));
889 return(L
" v" + strVersion);
905 catch(
const Exception &e)
924 catch(
const Exception &e)
938 if(((TSpeedButton*)Sender)->Down)
949 Screen->Cursor = TCursor(-11);
950 InfoPanel->Caption =
"SELECTING: Filling area with chosen element";
951 bool FillSelectionFlag =
false;
954 UnicodeString MessageStr =
955 "Click 'Yes' to fill the area with the chosen element or 'No' to abort.\n" "Existing elements won't be overwritten although track can\n"
956 "have platforms and non-station named location elements added.\n\nThis message will not be shown again.";
957 int button = Application->MessageBox(MessageStr.c_str(), L
"", MB_YESNO);
960 FillSelectionFlag =
true;
965 bool TrackLinkingRequiredFlag =
true;
994 Screen->Cursor = TCursor(-2);
1005 catch(
const Exception &e)
1047 ShowMessage(
"Incomplete track or other error - see inverted element (may be behind this message)");
1059 ShowMessage(
"Unable to set any track links");
1086 ShowMessage(
"Successful Completion");
1089 catch(
const Exception &e)
1110 catch(
const Exception &e)
1129 catch(
const Exception &e)
1148 catch(
const Exception &e)
1167 TFont *TempFont =
new TFont;
1175 TempText.
Font = DisplayFont;
1183 else if(Key ==
'\x1B')
1193 catch(
const Exception &e)
1212 catch(
const Exception &e)
1227 ShowMessage(
"Error, location name being entered without an entry in LNPendingList");
1247 Screen->Cursor = TCursor(-11);
1250 AnsiString ExistingName;
1264 UnicodeString MessageStr = UnicodeString(
"Another location named '") +
LocationNameTextBox->Text +
1265 UnicodeString(
"' already exists. If you continue its name will be erased. Do you wish to continue?");
1266 int button = Application->MessageBox(MessageStr.c_str(), L
"Warning!", MB_YESNO | MB_ICONWARNING);
1270 Screen->Cursor = TCursor(-2);
1281 bool UseExistingPosition =
false;
1290 if(ExistingName !=
"")
1294 UseExistingPosition =
true;
1298 Screen->Cursor = TCursor(-2);
1313 bool UseExistingPosition =
false;
1316 UseExistingPosition =
true;
1320 Screen->Cursor = TCursor(-2);
1333 LocStr = LocStr.Trim();
1342 if((LocStr !=
"") && (LocStr[1] >=
'0') && (LocStr[1] <=
'9'))
1344 Screen->Cursor = TCursor(-2);
1345 ShowMessage(
"Location name can't begin with a number");
1353 if(LocStr.Length() > 50)
1355 Screen->Cursor = TCursor(-2);
1356 ShowMessage(
"Location name too long, 50 characters maximum");
1364 for(
int x = 1; x <= LocStr.Length(); x++)
1366 char Ch = LocStr[x];
1367 if((Ch !=
' ') && (Ch !=
'&') && (Ch !=
'(') && (Ch !=
')') && (Ch !=
':') && (Ch != 39) && (Ch !=
'.') && (Ch !=
'-') && (Ch !=
'+') &&
1368 (Ch !=
'/') && ((Ch <
'0') || (Ch >
'9')) && ((Ch <
'A') || (Ch >
'Z')) && ((Ch <
'a') || (Ch >
'z')))
1370 Screen->Cursor = TCursor(-2);
1372 "Location name contains one or more invalid characters, must be alphanumeric, brackets, space, full stop, colon, inverted comma, '-', '+', '/' or '&&'");
1383 Screen->Cursor = TCursor(-2);
1384 ShowMessage(
"Location name cannot be 'cdt', this name would interfere with the timetable");
1395 bool UseExistingPosition =
false;
1396 if(ExistingName !=
"")
1400 UseExistingPosition =
true;
1404 Screen->Cursor = TCursor(-2);
1413 Screen->Cursor = TCursor(-2);
1416 catch(
const Exception &e)
1437 catch(
const Exception &e)
1451 int Dist = 0, SpeedLimit = 0;
1455 DistanceStr =
"No change";
1460 SpeedStr =
"No change";
1464 if(DistanceStr ==
"No change")
1468 if(SpeedStr ==
"No change")
1484 if(((Dist != -1) && (DistanceStr.Length() > 6)) || ((SpeedLimit != -1) && (SpeedStr.Length() > 6)))
1486 ShowMessage(
"One or more entries too long");
1490 if((DistanceStr ==
"") || (SpeedStr ==
""))
1492 ShowMessage(
"One or more entries blank");
1498 for(
int x = 1; x <= DistanceStr.Length(); x++)
1500 if((DistanceStr[x] <
'0') || (DistanceStr[x] >
'9'))
1502 ShowMessage(
"Track length value must be a positive whole number, or blank for no change");
1510 for(
int x = 1; x <= DistanceStr.Length(); x++)
1512 if((DistanceStr[x] <
'0') || (DistanceStr[x] >
'9'))
1514 ShowMessage(
"Distance must be a positive whole number");
1522 for(
int x = 1; x <= SpeedStr.Length(); x++)
1524 if((SpeedStr[x] <
'0') || (SpeedStr[x] >
'9'))
1526 ShowMessage(
"Speed limit must be a positive whole number, or blank for no change");
1534 for(
int x = 1; x <= SpeedStr.Length(); x++)
1536 if((SpeedStr[x] <
'0') || (SpeedStr[x] >
'9'))
1538 ShowMessage(
"Speed limit must be a positive whole number, or 'Mixed'");
1546 Dist = DistanceStr.ToInt();
1548 if(SpeedLimit != -1)
1550 SpeedLimit = SpeedStr.ToInt();
1559 if(((Dist != -1) && (Dist < 20)) || ((SpeedLimit != -1) && (SpeedLimit < 10)) || ((SpeedLimit != -1) && (SpeedLimit >
TTrain::MaximumSpeedLimit)))
1562 ShowMessage(
"Lengths must be 20m or more, and speeds must be between 10km/h and 400km/h");
1575 bool NamedLocPresent =
false;
1578 for(
int x = LowSelectHLoc; x < HighSelectHLoc; x++)
1580 for(
int y = LowSelectVLoc; y < HighSelectVLoc; y++)
1584 NamedLocPresent =
true;
1589 if(NamedLocPresent && (Dist < 50))
1593 ShowMessage(
"Note: Named location elements are quite short. If they are too short the simulation might be too unrealistic.\n\nThis message will not be shown again.");
1597 if(NamedLocPresent && (Dist > 200))
1601 ShowMessage(
"Note: Named location elements are quite long. If they are too long the simulation might be too unrealistic.\n\nThis message will not be shown again.");
1605 for(
int x = LowSelectHLoc; x < HighSelectHLoc; x++)
1607 for(
int y = LowSelectVLoc; y < HighSelectVLoc; y++)
1644 catch(
const Exception &e)
1667 catch(
const Exception &e)
1679 TMsgDlgButtons Buttons;
1680 Buttons << mbYes << mbNo;
1681 if(MessageDlg(
"This will reset the selected elements to default lengths & speed limits. Proceed?", mtWarning, Buttons, 0) == mrNo)
1700 for(
int x = LowSelectHLoc; x < HighSelectHLoc; x++)
1702 for(
int y = LowSelectVLoc; y < HighSelectVLoc; y++)
1756 throw Exception(
"Error, XLinkPos > 1 in SetOneDefaultTrackLength at " + AnsiString(TrackElement.
HLoc) +
" & " +
1757 AnsiString(TrackElement.
VLoc));
1773 catch(
const Exception &e)
1785 TMsgDlgButtons Buttons;
1786 Buttons << mbYes << mbNo;
1787 if(MessageDlg(
"This will reset ALL track elements to default lengths & speed limits. Proceed?", mtWarning, Buttons, 0) == mrNo)
1809 catch(
const Exception &e)
1837 bool GraphicFoundInVector =
false;
1838 for(TTrack::TUserGraphicVector::iterator UGVIt =
Track->
UserGraphicVector.begin(); UGVIt < Track->UserGraphicVector.end(); UGVIt++)
1840 if(UGMIt->first == UGVIt->FileName)
1842 GraphicFoundInVector =
true;
1846 if(!GraphicFoundInVector)
1848 delete UGMIt->second;
1864 catch(
const Exception &e)
1904 catch(
const Exception &e)
1943 catch(
const Exception &e)
1973 catch(
const Exception &e)
1999 catch(
const Exception &e)
2018 catch(
const Exception &e)
2033 ShowMessage(
"No preferred direction selection");
2037 Screen->Cursor = TCursor(-11);
2044 Screen->Cursor = TCursor(-2);
2047 catch(
const Exception &e)
2060 TMsgDlgButtons Buttons;
2061 Buttons << mbYes << mbNo;
2062 if(MessageDlg(
"Do you really want to clear all preferred directions?", mtWarning, Buttons, 0) == mrNo)
2078 catch(
const Exception &e)
2093 Screen->Cursor = TCursor(-11);
2102 Screen->Cursor = TCursor(-2);
2105 catch(
const Exception &e)
2123 catch(
const Exception &e)
2144 catch(
const Exception &e)
2169 catch(
const Exception &e)
2195 InfoPanel->Caption =
"PRE-START: Select AUTOMATIC SIGNAL ROUTE start signal, or left click points to change manually";
2199 InfoPanel->Caption =
"OPERATING: Select AUTOMATIC SIGNAL ROUTE start signal, or left click points to change manually";
2208 catch(
const Exception &e)
2235 InfoPanel->Caption =
"PRE-START: Select PREFERRED ROUTE start signal, or left click points to change manually";
2239 InfoPanel->Caption =
"OPERATING: Select PREFERRED ROUTE start signal, or left click points to change manually";
2248 catch(
const Exception &e)
2275 InfoPanel->Caption =
"PRE-START: Select PREFERRED ROUTE start signal, or left click points to change manually";
2279 InfoPanel->Caption =
"OPERATING: Select PREFERRED ROUTE start signal, or left click points to change manually";
2288 catch(
const Exception &e)
2321 InfoPanel->Caption =
"PRE-START: Select UNRESTRICTED ROUTE start location, or left click points to change manually";
2325 InfoPanel->Caption =
"OPERATING: Select UNRESTRICTED ROUTE start location, or left click points to change manually";
2334 catch(
const Exception &e)
2349 InfoPanel->Caption =
"ROUTE CANCELLING: Right click on truncate element, first element to cancel (anywhere else to skip)";
2356 catch(
const Exception &e)
2383 catch(
const Exception &e)
2398 UnicodeString MessageStr =
"Please note that the session will be lost if it hasn't been saved. Do you still wish to exit?";
2401 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
2440 catch(
const Exception &e)
2482 catch(
const Exception &e)
2495 Screen->Cursor = TCursor(-11);
2496 std::ifstream VecFile(LoadFileName.c_str());
2497 if(!(VecFile.fail()))
2502 bool GraphicsFollow =
false;
2521 TFont *TempFont =
new TFont;
2522 TempFont->Style.Clear();
2523 TempFont->Name =
"MS Sans Serif";
2524 TempFont->Size = 10;
2526 TempFont->Charset = (TFontCharset)(0);
2535 if((LeftExcess > 0) && (RightExcess > 0))
2539 else if((LeftExcess > 0) && (RightExcess <= 0))
2544 else if((LeftExcess <= 0) && (RightExcess > 0))
2556 if((TopExcess > 0) && (BotExcess > 0))
2560 else if((TopExcess > 0) && (BotExcess <= 0))
2565 else if((TopExcess <= 0) && (BotExcess > 0))
2582 if((LastChar ==
'y') || (LastChar ==
'Y'))
2586 ShowMessage(
"Railway not ready for operation so unable to load as a .rly file. Loading as a new railway under development");
2593 Screen->Cursor = TCursor(-2);
2627 ShowMessage(
"File open failed prior to load");
2629 Screen->Cursor = TCursor(-2);
2633 ShowMessage(
"File integrity check failed - unable to load " + LoadFileName +
". Please check that the file exists and is spelled correctly.");
2649 Screen->Cursor = TCursor(-11);
2651 if(!(VecFile.fail()))
2679 ShowMessage(
"File open failed prior to save");
2681 Screen->Cursor = TCursor(-2);
2686 catch(
const Exception &e)
2702 catch(
const Exception &e)
2719 ShowMessage(
"Failed to find folder " +
IMAGE_DIR_NAME +
" in the folder where 'railway.exe' resides. Image can't be saved");
2723 Screen->Cursor = TCursor(-11);
2726 AnsiString ImageFileName = TDateTime::CurrentDateTime().FormatString(
"dd-mm-yyyy hh.nn.ss");
2730 AnsiString ShortName =
"";
2731 for(
int x = ImageFileName.Length(); x > 0; x--)
2733 if(ImageFileName[x] ==
'\\')
2735 ShortName = ImageFileName.SubString(x + 1, ImageFileName.Length() - x - 4);
2739 ShowMessage(
"A bitmap file named " + ShortName +
" will be created in the Images folder");
2740 Graphics::TBitmap *RailwayImage =
new Graphics::TBitmap;
2741 RailwayImage->PixelFormat = pf8bit;
2747 RailwayImage->Width = HPosMax - HPosMin;
2748 RailwayImage->Height = VPosMax - VPosMin;
2756 int NewWidth = (TextPtr->HPos - HPosMin) + (abs(TextPtr->Font->Height) * TextPtr->TextString.Length() * 0.7);
2757 int NewHeight = (TextPtr->VPos - VPosMin) + (abs(TextPtr->Font->Height) * 1.5);
2758 if(NewWidth > RailwayImage->Width)
2760 RailwayImage->Width = NewWidth;
2762 if(NewHeight > RailwayImage->Height)
2764 RailwayImage->Height = NewHeight;
2768 RailwayImage->Canvas->Brush->Color =
clB5G5R5;
2769 TRect Rect(0, 0, RailwayImage->Width, RailwayImage->Height);
2770 RailwayImage->Canvas->FillRect(Rect);
2778 RailwayImage->SaveToFile(ImageFileName);
2779 delete RailwayImage;
2782 Screen->Cursor = TCursor(-2);
2785 catch(
const Exception &e)
2787 if(e.Message.Pos(
"torage") > 0)
2789 Screen->Cursor = TCursor(-2);
2790 UnicodeString MessageStr =
"Insufficient memory available to store this image";
2791 Application->MessageBox(MessageStr.c_str(), L
"", MB_OK | MB_ICONWARNING);
2812 ShowMessage(
"Failed to find folder " +
IMAGE_DIR_NAME +
" in the folder where 'railway.exe' resides. Image can't be saved");
2816 Screen->Cursor = TCursor(-11);
2819 AnsiString ImageFileName = TDateTime::CurrentDateTime().FormatString(
"dd-mm-yyyy hh.nn.ss");
2823 AnsiString ShortName =
"";
2824 for(
int x = ImageFileName.Length(); x > 0; x--)
2826 if(ImageFileName[x] ==
'\\')
2828 ShortName = ImageFileName.SubString(x + 1, ImageFileName.Length() - x - 4);
2832 ShowMessage(
"A bitmap file named " + ShortName +
" will be created in the Images folder");
2833 Graphics::TBitmap *RailwayImage =
new Graphics::TBitmap;
2834 RailwayImage->PixelFormat = pf8bit;
2839 RailwayImage->Width = HPosMax - HPosMin;
2840 RailwayImage->Height = VPosMax - VPosMin;
2848 int NewWidth = (TextPtr->HPos - HPosMin) + (abs(TextPtr->Font->Height) * TextPtr->TextString.Length() * 0.7);
2849 int NewHeight = (TextPtr->VPos - VPosMin) + (abs(TextPtr->Font->Height) * 1.5);
2850 if(NewWidth > RailwayImage->Width)
2852 RailwayImage->Width = NewWidth;
2854 if(NewHeight > RailwayImage->Height)
2856 RailwayImage->Height = NewHeight;
2860 RailwayImage->Canvas->Brush->Color =
clB5G5R5;
2861 TRect Rect(0, 0, RailwayImage->Width, RailwayImage->Height);
2862 RailwayImage->Canvas->FillRect(Rect);
2865 for(
int x = 0; x < ((RailwayImage->Width) / 16); x++)
2867 for(
int y = 0; y < ((RailwayImage->Height) / 16); y++)
2877 RailwayImage->SaveToFile(ImageFileName);
2878 delete RailwayImage;
2881 Screen->Cursor = TCursor(-2);
2884 catch(
const Exception &e)
2886 if(e.Message.Pos(
"torage") > 0)
2888 Screen->Cursor = TCursor(-2);
2889 UnicodeString MessageStr =
"Insufficient memory available to store this image";
2890 Application->MessageBox(MessageStr.c_str(), L
"", MB_OK | MB_ICONWARNING);
2910 ShowMessage(
"Failed to find folder " +
IMAGE_DIR_NAME +
" in the folder where 'railway.exe' resides. Image can't be saved");
2914 Screen->Cursor = TCursor(-11);
2917 AnsiString ImageFileName = TDateTime::CurrentDateTime().FormatString(
"dd-mm-yyyy hh.nn.ss");
2921 AnsiString ShortName =
"";
2922 for(
int x = ImageFileName.Length(); x > 0; x--)
2924 if(ImageFileName[x] ==
'\\')
2926 ShortName = ImageFileName.SubString(x + 1, ImageFileName.Length() - x - 4);
2930 ShowMessage(
"A bitmap file named " + ShortName +
" will be created in the Images folder");
2931 Graphics::TBitmap *RailwayImage =
new Graphics::TBitmap;
2932 RailwayImage->PixelFormat = pf8bit;
2937 RailwayImage->Width = HPosMax - HPosMin;
2938 RailwayImage->Height = VPosMax - VPosMin;
2946 int NewWidth = (TextPtr->HPos - HPosMin) + (abs(TextPtr->Font->Height) * TextPtr->TextString.Length() * 0.7);
2947 int NewHeight = (TextPtr->VPos - VPosMin) + (abs(TextPtr->Font->Height) * 1.5);
2948 if(NewWidth > RailwayImage->Width)
2950 RailwayImage->Width = NewWidth;
2952 if(NewHeight > RailwayImage->Height)
2954 RailwayImage->Height = NewHeight;
2958 RailwayImage->Canvas->Brush->Color =
clB5G5R5;
2959 TRect Rect(0, 0, RailwayImage->Width, RailwayImage->Height);
2960 RailwayImage->Canvas->FillRect(Rect);
2968 RailwayImage->SaveToFile(ImageFileName);
2969 delete RailwayImage;
2972 Screen->Cursor = TCursor(-2);
2975 catch(
const Exception &e)
2977 if(e.Message.Pos(
"torage") > 0)
2979 Screen->Cursor = TCursor(-2);
2980 UnicodeString MessageStr =
"Insufficient memory available to store this image";
2981 Application->MessageBox(MessageStr.c_str(), L
"", MB_OK | MB_ICONWARNING);
3001 ShowMessage(
"Failed to find folder " +
IMAGE_DIR_NAME +
" in the folder where 'railway.exe' resides. Image can't be saved");
3005 Screen->Cursor = TCursor(-11);
3010 TimetableTimeStr = TimetableTimeStr.SubString(1, 2) +
'.' + TimetableTimeStr.SubString(4, 2) +
'.' + TimetableTimeStr.SubString(7, 2);
3011 AnsiString ImageFileName = TDateTime::CurrentDateTime().FormatString(
"dd-mm-yyyy hh.nn.ss");
3016 AnsiString ShortName =
"";
3017 for(
int x = ImageFileName.Length(); x > 0; x--)
3019 if(ImageFileName[x] ==
'\\')
3021 ShortName = ImageFileName.SubString(x + 1, ImageFileName.Length() - x - 4);
3025 ShowMessage(
"A bitmap file named " + ShortName +
" will be created in the Images folder");
3026 Graphics::TBitmap *RailwayImage =
new Graphics::TBitmap;
3027 RailwayImage->PixelFormat = pf8bit;
3032 RailwayImage->Width = HPosMax - HPosMin;
3033 RailwayImage->Height = VPosMax - VPosMin;
3041 int NewWidth = (TextPtr->HPos - HPosMin) + (abs(TextPtr->Font->Height) * TextPtr->TextString.Length() * 0.7);
3042 int NewHeight = (TextPtr->VPos - VPosMin) + (abs(TextPtr->Font->Height) * 1.5);
3043 if(NewWidth > RailwayImage->Width)
3045 RailwayImage->Width = NewWidth;
3047 if(NewHeight > RailwayImage->Height)
3049 RailwayImage->Height = NewHeight;
3053 RailwayImage->Canvas->Brush->Color =
clB5G5R5;
3054 TRect Rect(0, 0, RailwayImage->Width, RailwayImage->Height);
3055 RailwayImage->Canvas->FillRect(Rect);
3070 bool BreakFlag =
false;
3096 RailwayImage->SaveToFile(ImageFileName);
3097 delete RailwayImage;
3100 Screen->Cursor = TCursor(-2);
3103 catch(
const Exception &e)
3105 if(e.Message.Pos(
"torage") > 0)
3107 Screen->Cursor = TCursor(-2);
3108 UnicodeString MessageStr =
"Insufficient memory available to store this image";
3109 Application->MessageBox(MessageStr.c_str(), L
"", MB_OK | MB_ICONWARNING);
3138 Screen->Cursor = TCursor(-11);
3140 if(!(VecFile.fail()))
3168 ShowMessage(
"Railway failed to save - can't open file");
3170 Screen->Cursor = TCursor(-2);
3174 catch(
const Exception &e)
3188 catch(
const Exception &e)
3210 catch(
const Exception &e)
3226 ShowMessage(
"Failed to find folder " +
FORMATTEDTT_DIR_NAME +
" in the folder where 'railway.exe' resides. Timetable can't be exported");
3234 Screen->Cursor = TCursor(-2);
3237 catch(
const Exception &e)
3297 AZOrderButton->Hint = AnsiString(
"Arrange services in alphabetical order Toggle with Shift+ Z");
3316 ActiveTrackElementNameMapEntry.second = 0;
3366 catch(
const Exception &e)
3415 if(TTBLFile.is_open())
3419 while(!TTBLFile.eof())
3422 if((c < 32) && (c != 13) && (c != 10) && (c !=
'\0'))
3424 ShowMessage(
"Timetable file is empty or contains non-ascii characters, codes must be between 20 and 127, or CR or LF");
3434 ShowMessage(
"Failed to open timetable file " +
CreateEditTTFileName +
", make sure it's spelled correctly, it exists and isn't open in another application");
3441 if(TTBLFile.is_open())
3450 AZOrderButton->Hint = AnsiString(
"Arrange services in alphabetical order Toggle with Shift+ Z");
3463 char *TimetableEntryString =
new char[10000];
3466 TTBLFile.getline(TimetableEntryString, 10000,
'\0');
3467 if(TTBLFile.eof() && (TimetableEntryString[0] ==
'\0'))
3473 AnsiString OneLine(TimetableEntryString);
3477 delete[]TimetableEntryString;
3482 ShowMessage(
"Failed to open timetable file " +
CreateEditTTFileName +
", make sure it's spelled correctly, it exists and isn't open in another application");
3518 ActiveTrackElementNameMapEntry.second = 0;
3543 catch(
const Exception &e)
3562 InfoPanel->Caption =
"Timetable mode: editor hidden";
3569 ShowHideTTButton->Hint =
"Hide the timetable editor to see the railway Shift H";
3574 catch(
const Exception &e)
3615 catch(
const Exception &e)
3656 catch(
const Exception &e)
3676 catch(
const Exception &e)
3689 bool ValidFlag =
true;
3710 TDateTime DummyTime;
3728 ShowMessage(
"One or more times excessive, not permitted to exceed 95 hours");
3732 AnsiString MinsStr = AnsiString(Mins), HrsStr = AnsiString(Hrs);
3735 MinsStr =
"0" + MinsStr;
3739 HrsStr =
"0" + HrsStr;
3743 NewString += HrsStr +
':' + MinsStr;
3760 catch(
const Exception &e)
3773 bool ValidFlag =
true;
3794 TDateTime DummyTime;
3812 ShowMessage(
"One or more times are now before 00:00, this is not permitted");
3816 AnsiString MinsStr = AnsiString(Mins), HrsStr = AnsiString(Hrs);
3819 MinsStr =
"0" + MinsStr;
3823 HrsStr =
"0" + HrsStr;
3827 NewString += HrsStr +
':' + MinsStr;
3843 catch(
const Exception &e)
3881 catch(
const Exception &e)
3926 if(OldVectorPos == 0)
3954 catch(
const Exception &e)
4013 catch(
const Exception &e)
4031 UnicodeString MessageStr =
"Are you sure this entry should be deleted?";
4032 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
4064 if(OldVectorPos == 0)
4092 catch(
const Exception &e)
4113 AnsiString TempStr =
"";
4114 bool ActiveLine =
false;
4139 while(TempStr[TempStr.Length()] ==
',')
4141 TempStr = TempStr.SubString(1, TempStr.Length() - 1);
4172 (*TTCurrentEntryPtr) = TempStr;
4242 catch(
const Exception &e)
4257 ShowMessage(
"Timetable is empty, can't save an empty timetable");
4261 std::ofstream TTBLFile;
4296 if(TTBLFile.is_open())
4300 TTBLFile << (*TEVPtr).c_str() <<
'\0';
4307 ShowMessage(
CreateEditTTFileName +
" failed to open, ensure not already open in another application");
4313 catch(
const Exception &e)
4328 ShowMessage(
"Timetable is empty, can't save an empty timetable");
4332 std::ofstream TTBLFile;
4341 for(
int x =
SaveTTDialog->FileName.Length(); x > 0; x--)
4359 if(TTBLFile.is_open())
4363 TTBLFile << (*TEVPtr).c_str() <<
'\0';
4370 ShowMessage(
CreateEditTTFileName +
" failed to open, ensure not already open in another application");
4376 catch(
const Exception &e)
4390 bool EndOfFile =
false;
4391 bool FinalCallFalse =
false;
4392 bool GiveMessagesTrue =
true;
4393 bool CheckLocationsExistInRailway =
false;
4396 CheckLocationsExistInRailway =
true;
4403 "The basic syntax seems OK but this check is very limited. Other aspects can only be checked by validating the whole timetable with the appropriate railway (.rly) loaded");
4409 catch(
const Exception &e)
4437 bool CheckLocationsExistInRailwayTrue =
true;
4440 Screen->Cursor = TCursor(-11);
4442 if(TTBLFile.is_open())
4448 ShowMessage(
"Timetable integrity OK");
4456 ShowMessage(
"Failed to open timetable file, make sure it's spelled correctly, it exists and isn't open in another application");
4458 Screen->Cursor = TCursor(-2);
4468 catch(
const Exception &e)
4492 AnsiString TempStr = *
TEVPtr;
4530 catch(
const Exception &e)
4554 AnsiString TempStr = *
TEVPtr;
4592 catch(
const Exception &e)
4629 catch(
const Exception &e)
4644 UnicodeString MessageStr =
"All changes to the timetable will be lost - proceed?";
4645 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
4655 if(TTBLFile.is_open())
4672 char *TimetableEntryString =
new char[10000];
4675 TTBLFile.getline(TimetableEntryString, 10000,
'\0');
4676 if(TTBLFile.eof() && (TimetableEntryString[0] ==
'\0'))
4682 AnsiString OneLine(TimetableEntryString);
4686 delete[]TimetableEntryString;
4691 ShowMessage(
"Failed to open timetable file, make sure it's spelled correctly, it exists and isn't open in another application");
4711 catch(
const Exception &e)
4726 ShowMessage(
"Failed to find folder " +
FORMATTEDTT_DIR_NAME +
" in the folder where 'railway.exe' resides. Timetable can't be exported");
4745 Screen->Cursor = TCursor(-2);
4750 catch(
const Exception &e)
4783 catch(
const Exception &e)
4798 UnicodeString MessageStr =
"The timetable has changed.\n\nAre you sure you want to exit without saving it?";
4799 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
4815 catch(
const Exception &e)
4843 catch(
const Exception &e)
4868 catch(
const Exception &e)
4886 catch(
const Exception &e)
4909 catch(
const Exception &e)
4961 catch(
const Exception &e)
4974 TrainController->
LogEvent(
"OAListBoxMouseUp," + AnsiString(X) +
"," + AnsiString(Y) +
"," + AnsiString(Button));
4986 int HPos, VPos, TrainID = -1, TrackVectorPosition = -1;
4993 if(Button == mbLeft)
5008 TPoint MainScreenPoint(ScreenPosH + 8, ScreenPosV + 8);
5009 TPoint CursPos =
MainScreen->ClientToScreen(MainScreenPoint);
5010 Mouse->CursorPos = CursPos;
5018 catch(
const Exception &e)
5032 if(Button == mbRight)
5038 catch(
const Exception &e)
5054 if((TopPos + (Y / 13)) >=
OAListBox->Items->Count)
5062 std::advance(OACurrentEntryPtr, ((Y / 13) + TopPos));
5064 int TrainIDorTVPos = OACurrentEntryPtr->second.second;
5065 if(TrainIDorTVPos >= 0)
5071 TrainID = TrainIDorTVPos;
5082 TrackVectorPosition = -(TrainIDorTVPos + 1);
5094 PreStartTime, ActiveSegment, PostEnd
5108 Segment = PreStartTime;
5111 if(Segment == PreStartTime)
5118 Segment = ActiveSegment;
5129 AnsiString CurrentStr = *
TEVPtr;
5130 if(CurrentStr !=
"")
5132 CurrentStr = CurrentStr.SubString(1, 10);
5133 for(
int x = 1; x < CurrentStr.Length(); x++)
5135 if((CurrentStr[x] < 32) || (CurrentStr[1] > 126))
5137 CurrentStr = CurrentStr.SubString(1, (x - 1));
5146 if(Segment == ActiveSegment)
5161 AnsiString Entry = *
TEVPtr;
5171 int SCPos = Entry.Pos(
';');
5172 int CPos = Entry.Pos(
',');
5179 if((CPos == 0) && (SCPos == 0))
5181 Entry = Entry.SubString(1, 12);
5183 else if((CPos > 0) && (SCPos > 0) && (CPos < SCPos))
5185 Entry = Entry.SubString(1, CPos - 1);
5187 else if((CPos > 0) && (SCPos > 0) && (CPos > SCPos))
5189 Entry = Entry.SubString(1, SCPos - 1);
5191 else if((CPos > 0) && (SCPos == 0))
5193 Entry = Entry.SubString(1, CPos - 1);
5197 Entry = Entry.SubString(1, SCPos - 1);
5210 if(Segment == PostEnd)
5218 AnsiString CurrentStr = *
TEVPtr;
5219 if(CurrentStr !=
"")
5221 CurrentStr = CurrentStr.SubString(1, 10);
5222 for(
int x = 1; x < CurrentStr.Length(); x++)
5224 if((CurrentStr[x] < 32) || (CurrentStr[1] > 126))
5226 CurrentStr = CurrentStr.SubString(1, (x - 1));
5257 UnicodeString MessageStr =
5258 "If you wish to preserve the original order don't save any changes whilst in alphabetical order.\n\n" "To preserve the original order use alphabetical order to find the service required, click it to display it,"
5259 " then revert to the original order where the same service will be displayed and can be changed.";
5260 Application->MessageBox(MessageStr.c_str(), L
"Please Note:", MB_OK | MB_ICONWARNING);
5273 std::sort(SortStart, SortEnd);
5275 bool CurrentEntryChanged =
false;
5281 CurrentEntryChanged =
true;
5284 if(!CurrentEntryChanged)
5289 AZOrderButton->Hint = AnsiString(
"Arrange services in original order Toggle with Shift+ Z");
5295 UnicodeString MessageStr =
5296 "Reverting to the original order will discard any changes made whilst in alphabetical order.\n\nTo preserve the changes click 'No', then save the timetable or use 'save as' if you wish to keep the original timetable.\n\nDo you wish to proceed?";
5297 int button = Application->MessageBox(MessageStr.c_str(), L
"Warning!", MB_YESNO | MB_ICONWARNING);
5311 bool CurrentEntryChanged =
false;
5317 CurrentEntryChanged =
true;
5320 if(!CurrentEntryChanged)
5325 AZOrderButton->Hint = AnsiString(
"Arrange services in alphabetical order Toggle with Shift+ Z");
5334 catch(
const Exception &e)
5345 AnsiString OutStr =
"";
5348 while(x < ConvStr.Length())
5350 if((ConvStr[x] ==
'\r') && (ConvStr[x + 1] ==
'\n'))
5358 OutStr += ConvStr[x];
5362 if(x == ConvStr.Length())
5364 OutStr += ConvStr[x];
5370 while(OutStr[OutStr.Length()] ==
',')
5372 OutStr = OutStr.SubString(1, OutStr.Length() - 1);
5446 InfoPanel->Caption =
"Select option or change entry";
5460 bool ValidFlag =
true;
5461 for(
int x = 1; x <= AnsiAddSubText.Length(); x++)
5463 if((AnsiAddSubText[x] >
'9') || (AnsiAddSubText[x] <
'0'))
5471 if(AnsiAddSubText.ToInt() != 0)
5544 bool ServiceEntry =
true;
5549 bool ServiceEntry =
false;
5561 InfoPanel->Caption =
"Add or change entry then save it, or cancel";
5571 AnsiString((
short)ServiceEntry));
5578 int CommaPos = Data.Pos(
',');
5579 if((CommaPos == 0) && (Data !=
""))
5581 CommaPos = Data.Length() + 1;
5584 if(Data.Length() <= CommaPos)
5588 Data = Data.SubString(CommaPos + 1, Data.Length() - CommaPos);
5627 if(CurrentStr !=
"")
5629 for(
int x = 1; x < CurrentStr.Length(); x++)
5631 if((CurrentStr[x] < 32) || (CurrentStr[1] > 126))
5633 CurrentStr = CurrentStr.SubString(1, (x - 1));
5666 TDateTime DummyTime;
5667 bool TimesPresent =
false;
5675 TimesPresent =
true;
5684 return(TimesPresent);
5711 UnicodeString MessageStr =
"The railway has changed, exit without saving?";
5712 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
5724 Application->Terminate();
5726 catch(
const Exception &e)
5749 catch(
const Exception &e)
5772 catch(
const Exception &e)
5795 catch(
const Exception &e)
5872 catch(
const Exception &e)
5890 catch(
const Exception &e)
5909 catch(
const Exception &e)
5953 catch(
const Exception &e)
5964 TrainController->
LogEvent(
"MainScreenMouseDown2," + AnsiString(Button) +
"," + AnsiString(X) +
"," + AnsiString(Y));
5966 "," + AnsiString(Y));
5977 int NoOffsetX, NoOffsetY;
5979 if(Button == mbRight)
5983 AnsiString Text =
"";
5990 Screen->Cursor = TCursor(-22);
6046 bool TrackEraseSuccessfulFlag;
6047 int ErasedTrackVectorPosition;
6048 Screen->Cursor = TCursor(-11);
6050 if(TrackEraseSuccessfulFlag)
6052 if(ErasedTrackVectorPosition > -1)
6085 Screen->Cursor = TCursor(-2);
6093 bool LeadingPointsAtLastElement =
false;
6108 if(!LeadingPointsAtLastElement)
6113 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Continue or set values (overall length), or right click to cancel/truncate";
6132 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Can't end on leading points, continue or truncate";
6210 if((TrainID01 > -1) && (TrainID23 > -1))
6260 AnsiString LocName =
"";
6265 if((LocName ==
"") && (Train.
MidElement > -1))
6387 Screen->Cursor = TCursor(-11);
6398 Screen->Cursor = TCursor(-2);
6474 Screen->Cursor = TCursor(-11);
6476 bool TrackLinkingRequiredFlag;
6478 TSpeedButton *TempSpeedButton = 0;
6488 bool InternalChecks =
true;
6496 if(TrackLinkingRequiredFlag)
6525 Screen->Cursor = TCursor(-2);
6539 NewGI.
Width = UGMIt->second->Width;
6540 NewGI.
Height = UGMIt->second->Height;
6566 AnsiString NameString;
6576 unsigned int ValidPosition;
6587 ValidElement = InactiveTrackElement1;
6588 ValidPosition = InactivePair.first;
6593 ValidElement = InactiveTrackElement2;
6594 ValidPosition = InactivePair.second;
6605 InfoPanel->Caption =
"NAMING LOCATIONS: Enter name, 'Carriage Return' to accept, 'Escape' to quit";
6636 bool FinishElement =
false, LeadingPointsAtLastElement =
false;
6637 Screen->Cursor = TCursor(-11);
6652 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Set values (overall length), or right click to cancel/truncate";
6666 Screen->Cursor = TCursor(-2);
6672 if(!LeadingPointsAtLastElement)
6677 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Continue or set values (overall length), or right click to cancel/truncate";
6698 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Can't end on leading points, need to continue or truncate";
6713 Screen->Cursor = TCursor(-2);
6718 Screen->Cursor = TCursor(-2);
6736 InfoPanel->Caption =
"CONNECTING GAPS: Connecting element selected";
6748 ShowMessage(
"All gaps set");
6776 int TrueX = 0, TrueY = 0;
6777 AnsiString ExistingText =
"";
6779 TFont *ExistingTextFont =
new TFont;
6780 int ExistingTextHPos = 0, ExistingTextVPos = 0;
6786 if((TrueX >= TextPtr->HPos) && (TrueX < (TextPtr->HPos + abs(TextPtr->Font->Height))) && (TrueY >= TextPtr->VPos) && (TrueY <
6787 (TextPtr->VPos + abs(TextPtr->Font->Height))))
6789 ExistingText = TextPtr->TextString;
6790 ExistingTextFont->Assign(TextPtr->Font);
6791 ExistingTextHPos = TextPtr->HPos;
6792 ExistingTextVPos = TextPtr->VPos;
6805 TextBox->Font->Assign(ExistingTextFont);
6807 Text_X = ExistingTextHPos;
6808 Text_Y = ExistingTextVPos;
6826 TextBox->Text =
"New Text: CR=end, ESC=quit";
6830 delete ExistingTextFont;
6932 Screen->Cursor = TCursor(-11);
6943 ShowMessage(
"Preferred direction added");
6947 Screen->Cursor = TCursor(-2);
6966 Screen->Cursor = TCursor(-2);
6970 Screen->Cursor = TCursor(-2);
7067 AnsiString(PDE.
VLoc));
7081 bool PointsChanged =
false;
7082 IDInt ReqPosRouteID(-1);
7084 bool CallonTrue =
true;
7092 ReqPosRouteID, PointsChanged))
7134 float TempSpeedVal = 1;
7204 int DivergingPosition = TrackElement.
Conn[3];
7206 DivergingPosition)))
7235 bool TrainPresent =
false;
7239 int BDVectorPos = -1;
7249 TDateTime TempExcessLCDownTime;
7260 if(TempExcessLCDownTime > TDateTime(0))
7290 AnsiString Message =
7291 AnsiString(
"This will open the level crossing manually (it will show in green).\n\nA manually opened"
7292 " level crossing must be manually closed, and as soon as possible to avoid time penalties.\n\n" "This message will not be shown again."
7337 InfoPanel->Caption =
"PRE-START: Select next route location";
7341 InfoPanel->Caption =
"OPERATING: Select next route location";
7354 bool CallonFalse =
false;
7362 InfoPanel->Caption =
"PRE-START: Select next route location";
7366 InfoPanel->Caption =
"OPERATING: Select next route location";
7388 Screen->Cursor = TCursor(-11);
7390 bool PointsChanged =
false;
7400 float TempSpeedVal = 1;
7409 else if(PointsChanged)
7424 Screen->Cursor = TCursor(-2);
7432 bool CallonFalse =
false;
7437 float TempSpeedVal = 1;
7446 else if(PointsChanged)
7464 Screen->Cursor = TCursor(-2);
7472 catch(
const Exception &e)
7486 TrainController->
LogEvent(
"MainScreenMouseDown3," + AnsiString(Button) +
"," + AnsiString(X) +
"," + AnsiString(Y));
7488 "," + AnsiString(Y));
7489 if(Button != mbLeft)
7495 Screen->Cursor = TCursor(-22);
7501 int HRounding, VRounding;
7574 else if(TempLevel2OperMode ==
Operating)
7577 OperateButton->Glyph->LoadFromResourceName(0,
"PauseGraphic");
7581 else if(TempLevel2OperMode ==
Paused)
7584 OperateButton->Glyph->LoadFromResourceName(0,
"RunGraphic");
7590 else if(TempLevel2OperMode ==
PreStart)
7593 OperateButton->Glyph->LoadFromResourceName(0,
"RunGraphic");
7604 catch(
const Exception &e)
7705 if(CurrentHLoc >= StartHLoc)
7713 if(CurrentVLoc >= StartVLoc)
7737 TRect TempRect(StartHLoc, StartVLoc, CurrentHLoc, CurrentVLoc);
7755 if(CurrentHLoc >= StartHLoc)
7763 if(CurrentVLoc >= StartVLoc)
7787 TRect TempRect(StartHLoc, StartVLoc, CurrentHLoc, CurrentVLoc);
7866 catch(
const Exception &e)
7902 TrainController->
LogEvent(
"MainScreenMouseUp," + AnsiString(Button) +
"," + AnsiString(X) +
"," + AnsiString(Y));
7905 Screen->Cursor = TCursor(-2);
7915 Screen->Cursor = TCursor(-11);
7920 if(EndHLoc >= StartHLoc)
7928 if(EndVLoc >= StartVLoc)
7936 if(StartHLoc >= EndHLoc)
7946 if(StartVLoc >= EndVLoc)
7983 Screen->Cursor = TCursor(-2);
8055 if(IATVecPair.second != IATVecPair.first)
8065 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
8075 if(PrefDirPos0 > -1)
8080 if(PrefDirPos1 > -1)
8085 if(PrefDirPos2 > -1)
8090 if(PrefDirPos3 > -1)
8109 if((TextPtr->HPos >= LowSelectHPos) && (TextPtr->HPos < HighSelectHPos) && (TextPtr->VPos >= LowSelectVPos) && (TextPtr->VPos <
8117 bool SelectVectorNamedElement =
false;
8118 AnsiString SelectTextString;
8123 SelectVectorNamedElement =
true;
8127 if(SelectVectorNamedElement)
8129 SelectTextString =
"##**" + TextPtr->TextString;
8133 SelectTextString = TextPtr->TextString;
8135 TTextItem TextItem(TextPtr->HPos, TextPtr->VPos, SelectTextString, TextPtr->Font);
8144 for(TTrack::TUserGraphicVector::iterator UserGraphicPtr =
Track->
UserGraphicVector.begin(); UserGraphicPtr < Track->UserGraphicVector.end();
8147 if((UserGraphicPtr->HPos >= LowSelectHPos) && ((UserGraphicPtr->HPos + UserGraphicPtr->Width) < HighSelectHPos) &&
8148 (UserGraphicPtr->VPos >= LowSelectVPos) && ((UserGraphicPtr->VPos + UserGraphicPtr->Height) < HighSelectVPos))
8161 Screen->Cursor = TCursor(-2);
8167 Screen->Cursor = TCursor(-11);
8173 if(EndHLoc >= StartHLoc)
8181 if(EndVLoc >= StartVLoc)
8189 if(StartHLoc >= EndHLoc)
8199 if(StartVLoc >= EndVLoc)
8232 Screen->Cursor = TCursor(-2);
8264 Screen->Cursor = TCursor(-2);
8289 catch(
const Exception &e)
8327 throw Exception(
"Warning - Utilities->CallLog contains more than 50 items");
8352 catch(
const Exception &e)
8448 if(
WholeRailwayMoving && (GetAsyncKeyState(VK_LBUTTON) >= 0) && (GetAsyncKeyState(VK_RBUTTON) >= 0))
8451 Screen->Cursor = TCursor(-2);
8476 bool TrainPresent =
false;
8493 TDateTime TempExcessLCDownTime;
8502 if(TempExcessLCDownTime > TDateTime(0))
8531 bool ElementRemovedFlag =
false;
8548 int RouteNumber1, RouteNumber2, TrainID;
8556 ElementRemovedFlag =
true;
8572 bool WH1 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog1->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog1->Width +
OutputLog1->Left))
8575 bool WH2 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog2->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog2->Width +
OutputLog2->Left))
8578 bool WH3 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog3->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog3->Width +
OutputLog3->Left))
8581 bool WH4 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog4->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog4->Width +
OutputLog4->Left))
8584 bool WH5 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog5->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog5->Width +
OutputLog5->Left))
8587 bool WH6 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog6->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog6->Width +
OutputLog6->Left))
8590 bool WH7 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog7->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog7->Width +
OutputLog7->Left))
8593 bool WH8 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog8->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog8->Width +
OutputLog8->Left))
8596 bool WH9 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog9->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog9->Width +
OutputLog9->Left))
8599 bool WH10 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog10->Left) &&
8603 if(WH1 || WH2 || WH3 || WH4 || WH5 || WH6 || WH7 || WH8 || WH9 || WH10)
8623 AnsiString Type[15] =
8625 "Simple",
"Crossover",
"Points",
"Buffers",
"Bridge",
"SignalPost",
"Continuation",
"Platform",
"GapJump",
"FootCrossing",
"Unused",
"Concourse",
8626 "Parapet",
"NamedNonStationLocation",
"Erase"
8629 int ScreenX = Mouse->CursorPos.x -
MainScreen->ClientOrigin.x;
8630 int ScreenY = Mouse->CursorPos.y -
MainScreen->ClientOrigin.y;
8632 AnsiString MouseStr =
"Posx: " + AnsiString(ScreenX) +
"; Posy: " + AnsiString(ScreenY);
8637 DevelopmentPanel->Caption = MouseStr +
"; TVPos: " + AnsiString(Position) +
"; H: " + AnsiString(HLoc) +
"; V: " + AnsiString(VLoc) +
8638 "; SpTg: " + AnsiString(TrackElement.
SpeedTag) +
"; Type: " + Type[TrackElement.
TrackType] +
"; Att: " + AnsiString(TrackElement.
Attribute)
8655 if((GetKeyState(VK_LBUTTON) >= 0) && (GetKeyState(VK_RBUTTON) >= 0) && (
TTCurrentEntryPtr > 0))
8785 Screen->Cursor = TCursor(-11);
8970 int RouteStartVecPos;
8986 if(FoundFlag && (RouteStartVecPos > -1))
9002 catch(
const Exception &e)
9020 InfoPanel->Caption =
"CALLING ON: Select signal for call on";
9034 catch(
const Exception &e)
9048 Screen->Cursor = TCursor(-11);
9092 Screen->Cursor = TCursor(-2);
9095 catch(
const Exception &e)
9109 Screen->Cursor = TCursor(-11);
9153 Screen->Cursor = TCursor(-2);
9156 catch(
const Exception &e)
9170 Screen->Cursor = TCursor(-11);
9215 Screen->Cursor = TCursor(-2);
9218 catch(
const Exception &e)
9232 Screen->Cursor = TCursor(-11);
9276 Screen->Cursor = TCursor(-2);
9279 catch(
const Exception &e)
9293 Screen->Cursor = TCursor(-11);
9334 OperateButton->Glyph->LoadFromResourceName(0,
"PauseGraphic");
9341 OperateButton->Glyph->LoadFromResourceName(0,
"RunGraphic");
9350 OperateButton->Glyph->LoadFromResourceName(0,
"RunGraphic");
9377 if((LeftExcess > 0) && (RightExcess > 0))
9381 else if((LeftExcess > 0) && (RightExcess <= 0))
9386 else if((LeftExcess <= 0) && (RightExcess > 0))
9398 if((TopExcess > 0) && (BotExcess > 0))
9402 else if((TopExcess > 0) && (BotExcess <= 0))
9407 else if((TopExcess <= 0) && (BotExcess > 0))
9423 ZoomButton->Glyph->LoadFromResourceName(0,
"ZoomIn");
9425 Screen->Cursor = TCursor(-2);
9429 catch(
const Exception &e)
9443 Screen->Cursor = TCursor(-11);
9468 Screen->Cursor = TCursor(-2);
9472 catch(
const Exception &e)
9500 catch(
const Exception &e)
9516 catch(
const Exception &e)
9537 ShowMessage(
"Please be aware when pasting that anything inside the pasted area will be overwritten.\n\nThis warning will not be shown again.");
9548 catch(
const Exception &e)
9570 TRect NewSelectRect(TLHCH, TLHCV, BRHCH, BRHCV);
9608 catch(
const Exception &e)
9629 catch(
const Exception &e)
9650 catch(
const Exception &e)
9688 int FlipLinkArray[10] =
9690 0, 7, 8, 9, 4, 5, 6, 1, 2, 3
9711 bool ELinkPosFound =
false, XLinkPosFound =
false;
9712 for(
int y = 0; y < 4; y++)
9714 if(!ELinkPosFound && (PDE.
Link[y] == ELink))
9717 ELinkPosFound =
true;
9719 if(!XLinkPosFound && (PDE.
Link[y] == XLink))
9722 XLinkPosFound =
true;
9731 bool FoundFlag =
false;
9738 if(!PDE.
EntryExitNumber() || !ELinkPosFound || !XLinkPosFound || !FoundFlag)
9741 ShowMessage(
"Unable to re-orientate the preferred directions, these won't be set in the rotated selection");
9760 int MidVPosAfterFlip = ((VerSum * 16) + 15) - MidVPosBeforeFlip;
9768 catch(
const Exception &e)
9806 int MirrorLinkArray[10] =
9808 0, 3, 2, 1, 6, 5, 4, 9, 8, 7
9829 bool ELinkPosFound =
false, XLinkPosFound =
false;
9830 for(
int y = 0; y < 4; y++)
9832 if(!ELinkPosFound && (PDE.
Link[y] == ELink))
9835 ELinkPosFound =
true;
9837 if(!XLinkPosFound && (PDE.
Link[y] == XLink))
9840 XLinkPosFound =
true;
9848 bool FoundFlag =
false;
9855 if(!PDE.
EntryExitNumber() || !ELinkPosFound || !XLinkPosFound || !FoundFlag)
9858 ShowMessage(
"Unable to re-orientate the preferred directions, these won't be set in the rotated selection");
9877 int MidHPosAfterMirror = ((HorSum * 16) + 15) - MidHPosBeforeMirror;
9879 if(LeftPosAfterMirror < (
SelectRect.left * 16))
9889 catch(
const Exception &e)
9931 int Rot180LinkArray[10] =
9933 0, 9, 8, 7, 6, 5, 4, 3, 2, 1
9953 bool ELinkPosFound =
false, XLinkPosFound =
false;
9954 for(
int y = 0; y < 4; y++)
9956 if(!ELinkPosFound && (PDE.
Link[y] == ELink))
9959 ELinkPosFound =
true;
9961 if(!XLinkPosFound && (PDE.
Link[y] == XLink))
9964 XLinkPosFound =
true;
9972 bool FoundFlag =
false;
9979 if(!PDE.
EntryExitNumber() || !ELinkPosFound || !XLinkPosFound || !FoundFlag)
9982 ShowMessage(
"Unable to re-orientate the preferred directions, these won't be set in the rotated selection");
10002 int MidVPosAfterFlip = ((VerSum * 16) + 15) - MidVPosBeforeFlip;
10014 int MidHPosAfterMirror = ((HorSum * 16) + 15) - MidHPosBeforeMirror;
10016 if(LeftPosAfterMirror < (
SelectRect.left * 16))
10028 catch(
const Exception &e)
10041 Screen->Cursor = TCursor(-11);
10058 int button = Application->MessageBox
10059 (L
"Original selection adjusted to make it square. 'OK' to keep this selection or 'Cancel' to make a new selection",
10060 L
"Left click and hold here to move this message box", MB_OKCANCEL);
10061 if(button == IDCANCEL)
10069 Screen->Cursor = TCursor(-2);
10109 if(IATVecPair.second != IATVecPair.first)
10119 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
10129 if(PrefDirPos0 > -1)
10134 if(PrefDirPos1 > -1)
10139 if(PrefDirPos2 > -1)
10144 if(PrefDirPos3 > -1)
10157 int HighSelectVPos =
SelectRect.bottom * 16;
10163 if((TextPtr->HPos >= LowSelectHPos) && (TextPtr->HPos < HighSelectHPos) && (TextPtr->VPos >= LowSelectVPos) && (TextPtr->VPos < HighSelectVPos))
10170 bool SelectVectorNamedElement =
false;
10171 AnsiString SelectTextString;
10176 SelectVectorNamedElement =
true;
10180 if(SelectVectorNamedElement)
10182 SelectTextString =
"##**" + TextPtr->TextString;
10186 SelectTextString = TextPtr->TextString;
10188 TTextItem TextItem(TextPtr->HPos, TextPtr->VPos, SelectTextString, TextPtr->Font);
10198 for(TTrack::TUserGraphicVector::iterator UserGraphicPtr =
Track->
UserGraphicVector.begin(); UserGraphicPtr < Track->UserGraphicVector.end();
10201 if((UserGraphicPtr->HPos >= LowSelectHPos) && ((UserGraphicPtr->HPos + UserGraphicPtr->Width) < HighSelectHPos) && (UserGraphicPtr->VPos >=
10202 LowSelectVPos) && ((UserGraphicPtr->VPos + UserGraphicPtr->Height) < HighSelectVPos))
10228 int RotRightLinkArray[10] =
10230 0, 3, 6, 9, 2, 5, 8, 1, 4, 7
10250 bool ELinkPosFound =
false, XLinkPosFound =
false;
10251 for(
int y = 0; y < 4; y++)
10253 if(!ELinkPosFound && (PDE.
Link[y] == ELink))
10256 ELinkPosFound =
true;
10258 if(!XLinkPosFound && (PDE.
Link[y] == XLink))
10261 XLinkPosFound =
true;
10269 bool FoundFlag =
false;
10276 if(!PDE.
EntryExitNumber() || !ELinkPosFound || !XLinkPosFound || !FoundFlag)
10279 ShowMessage(
"Unable to re-orientate the preferred directions, these won't be set in the rotated selection");
10301 int MidHPosAfterRotate = ((
SelectRect.bottom * 16) - 1) + (
SelectRect.left * 16) - MidVPosBeforeRotate;
10308 Screen->Cursor = TCursor(-2);
10313 catch(
const Exception &e)
10327 Screen->Cursor = TCursor(-11);
10344 int button = Application->MessageBox
10345 (L
"Original selection adjusted to make it square. 'OK' to keep this selection or 'Cancel' to make a new selection",
10346 L
"Left click and hold here to move this message box", MB_OKCANCEL);
10347 if(button == IDCANCEL)
10355 Screen->Cursor = TCursor(-2);
10395 if(IATVecPair.second != IATVecPair.first)
10405 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
10415 if(PrefDirPos0 > -1)
10420 if(PrefDirPos1 > -1)
10425 if(PrefDirPos2 > -1)
10430 if(PrefDirPos3 > -1)
10443 int HighSelectVPos =
SelectRect.bottom * 16;
10449 if((TextPtr->HPos >= LowSelectHPos) && (TextPtr->HPos < HighSelectHPos) && (TextPtr->VPos >= LowSelectVPos) && (TextPtr->VPos < HighSelectVPos))
10456 bool SelectVectorNamedElement =
false;
10457 AnsiString SelectTextString;
10462 SelectVectorNamedElement =
true;
10466 if(SelectVectorNamedElement)
10468 SelectTextString =
"##**" + TextPtr->TextString;
10472 SelectTextString = TextPtr->TextString;
10474 TTextItem TextItem(TextPtr->HPos, TextPtr->VPos, SelectTextString, TextPtr->Font);
10484 for(TTrack::TUserGraphicVector::iterator UserGraphicPtr =
Track->
UserGraphicVector.begin(); UserGraphicPtr < Track->UserGraphicVector.end();
10487 if((UserGraphicPtr->HPos >= LowSelectHPos) && ((UserGraphicPtr->HPos + UserGraphicPtr->Width) < HighSelectHPos) && (UserGraphicPtr->VPos >=
10488 LowSelectVPos) && ((UserGraphicPtr->VPos + UserGraphicPtr->Height) < HighSelectVPos))
10514 int RotLeftLinkArray[10] =
10516 0, 7, 4, 1, 8, 5, 2, 9, 6, 3
10536 bool ELinkPosFound =
false, XLinkPosFound =
false;
10537 for(
int y = 0; y < 4; y++)
10539 if(!ELinkPosFound && (PDE.
Link[y] == ELink))
10542 ELinkPosFound =
true;
10544 if(!XLinkPosFound && (PDE.
Link[y] == XLink))
10547 XLinkPosFound =
true;
10555 bool FoundFlag =
false;
10562 if(!PDE.
EntryExitNumber() || !ELinkPosFound || !XLinkPosFound || !FoundFlag)
10565 ShowMessage(
"Unable to re-orientate the preferred directions, these won't be set in the rotated selection");
10588 int MidVPosAfterRotate = ((
SelectRect.bottom * 16) - 1) + (
SelectRect.left * 16) - MidHPosBeforeRotate;
10594 Screen->Cursor = TCursor(-2);
10599 catch(
const Exception &e)
10619 catch(
const Exception &e)
10638 catch(
const Exception &e)
10656 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Set values or leave blank for no change";
10659 ShowMessage(
"Note: length value will apply to each element's track within the selection.\n\nThis message will not be shown again.");
10669 catch(
const Exception &e)
10687 bool FoundFlag =
false;
10731 catch(
const Exception &e)
10763 Clipboard()->Clear();
10764 Clipboard()->Close();
10767 catch(
const EClipboardException &e)
10772 catch(
const Exception &e)
10790 int PD0, PD1, PD2, PD3, HLoc, VLoc, LastHLoc = -2000000, LastVLoc = -2000000;
10791 AnsiString TempInfo =
InfoPanel->Caption;
10794 ShowMessage(
"No preferred directions set.");
10802 InfoPanel->Caption =
"Checking preferred directions - please wait";
10805 LastHVPair.first = -2000000;
10806 LastHVPair.second = -2000000;
10807 Screen->Cursor = TCursor(-11);
10810 bool BiDirLinkFound =
true;
10811 int LinkedPrefDirVectorNumber;
10812 THVPair CurrentHVPair = PDMMIt->first;
10813 if(CurrentHVPair != LastHVPair)
10817 if((PD0 > -1) && (PD1 > -1))
10826 BiDirLinkFound =
false;
10831 BiDirLinkFound =
false;
10835 if(BiDirLinkFound && (PD0 > -1) && (PD2 > -1))
10843 BiDirLinkFound =
false;
10848 BiDirLinkFound =
false;
10852 if(BiDirLinkFound && (PD0 > -1) && (PD3 > -1))
10860 BiDirLinkFound =
false;
10865 BiDirLinkFound =
false;
10869 if(BiDirLinkFound && (PD1 > -1) && (PD2 > -1))
10877 BiDirLinkFound =
false;
10882 BiDirLinkFound =
false;
10886 if(BiDirLinkFound && (PD1 > -1) && (PD3 > -1))
10894 BiDirLinkFound =
false;
10899 BiDirLinkFound =
false;
10903 if(BiDirLinkFound && (PD2 > -1) && (PD3 > -1))
10911 BiDirLinkFound =
false;
10916 BiDirLinkFound =
false;
10920 if(!BiDirLinkFound)
10924 if((LastHLoc != HLoc) || (LastVLoc != VLoc))
10946 Screen->Cursor = TCursor(-2);
10947 int Button = Application->MessageBox(L
"Possible mismatch in preferred direction links \n"
10948 "at the position shown - see inverted element (may \n"
10949 "be behind this message). \n\n"
10950 "Click 'OK' to ignore and continue checking or \n"
10951 "'Cancel' to allow correction.", L
"Warning", MB_OKCANCEL | MB_ICONWARNING);
10953 if(Button == IDCANCEL)
10959 Screen->Cursor = TCursor(-11);
10964 LastHVPair = CurrentHVPair;
10966 bool ELinkFound =
false, BiDir =
false;
11034 if((LastHLoc != HLoc) || (LastVLoc != VLoc))
11056 Screen->Cursor = TCursor(-2);
11057 int Button = Application->MessageBox(L
"Possible mismatch in preferred direction links \n"
11058 "at the position shown - see inverted element (may \n"
11059 "be behind this message). \n\n"
11060 "Click 'OK' to ignore and continue checking or \n"
11061 "'Cancel' to allow correction.", L
"Warning", MB_OKCANCEL | MB_ICONWARNING);
11063 if(Button == IDCANCEL)
11069 Screen->Cursor = TCursor(-11);
11074 bool XLinkFound =
false;
11143 if((LastHLoc != HLoc) || (LastVLoc != VLoc))
11165 Screen->Cursor = TCursor(-2);
11166 int Button = Application->MessageBox(L
"Possible mismatch in preferred direction links \n"
11167 "at the position shown - see inverted element (may \n"
11168 "be behind this message). \n\n"
11169 "Click 'OK' to ignore and continue checking or \n"
11170 "'Cancel' to allow correction.", L
"Warning", MB_OKCANCEL | MB_ICONWARNING);
11172 if(Button == IDCANCEL)
11178 Screen->Cursor = TCursor(-11);
11184 Screen->Cursor = TCursor(-2);
11185 ShowMessage(
"Finished");
11189 catch(
const Exception &e)
11191 Screen->Cursor = TCursor(-2);
11192 ShowMessage(
"Error in preferred direction checking, unable to complete the check");
11224 bool CheckLocationsExistInRailwayTrue =
true;
11228 Screen->Cursor = TCursor(-11);
11229 std::ifstream TTBLFile(AnsiString(
TimetableDialog->FileName).c_str(), std::ios_base::binary);
11230 if(TTBLFile.is_open())
11232 bool SessionFileFalse =
false;
11241 ShowMessage(
"Failed to open timetable file, make sure it's spelled correctly, it exists and isn't open in another application");
11243 Screen->Cursor = TCursor(-2);
11247 ShowMessage(
"Timetable integrity check failed - unable to load " +
TimetableDialog->FileName +
". Please check that the file exists and is spelled correctly.");
11254 catch(
const Exception &e)
11281 AnsiString LocName =
"";
11286 if((LocName ==
"") && (Train.
MidElement > -1))
11304 if((NextElementPosition > -1) && (NextEntryPos > -1))
11320 if((LocName ==
"") && (Train.
MidElement > -1))
11327 catch(
const Exception &e)
11361 if((LeadElementLocName ==
"") && (MidElementLocName ==
"") && (Train.
LeadElement > -1))
11365 if((LeadElementLocName ==
"") && (Train.
MidElement > -1))
11369 if((LeadElementLocName == RequiredLocName) || (MidElementLocName == RequiredLocName))
11371 LocName = RequiredLocName;
11403 int NextElementPos = -1;
11404 int NextEntryPos = -1;
11423 if((NextElementPos > -1) && (NextEntryPos > -1))
11457 catch(
const Exception &e)
11475 AnsiString LocName =
"";
11480 if((LocName ==
"") && (Train.
MidElement > -1))
11488 if((LocName ==
"") && (Train.
MidElement > -1))
11495 catch(
const Exception &e)
11525 int NextElementPos = -1;
11526 int NextEntryPos = -1;
11534 if((NextElementPos > -1) && (NextEntryPos > -1))
11554 catch(
const Exception &e)
11568 TTrain *TrainToBeJoinedBy;
11581 ShowMessage(
"Can't join two trains when both are without power");
11585 AnsiString TrainToBeJoinedByHeadCode = TrainToBeJoinedBy->
HeadCode;
11587 double OtherBrakeForce = TrainToBeJoinedBy->
MaxBrakeRate * TrainToBeJoinedBy->
Mass;
11589 double CombinedBrakeRate = (OtherBrakeForce + OwnBrakeForce) / (TrainToBeJoinedBy->
Mass + ThisTrain.
Mass);
11590 ThisTrain.
Mass += TrainToBeJoinedBy->
Mass;
11597 AnsiString LocName =
"";
11602 if((LocName ==
"") && (ThisTrain.
MidElement > -1))
11606 if((LocName ==
"") && ThisTrain.
LeadElement > -1)
11610 if((LocName ==
"") && (ThisTrain.
MidElement > -1))
11644 catch(
const Exception &e)
11675 AnsiString LocName =
"";
11680 if((LocName ==
"") && (Train.
MidElement > -1))
11688 if((LocName ==
"") && (Train.
MidElement > -1))
11704 catch(
const Exception &e)
11739 catch(
const Exception &e)
11755 if(NextElementPos < 0)
11757 throw Exception(
"Error, no element in front in PassRedSignalMenuItemClick");
11768 throw Exception(
"Error, next element not a signal type in PassRedSignalMenuItemClick");
11782 catch(
const Exception &e)
11808 int NextElementPos = -1;
11810 int NextEntryPos = -1;
11818 if((NextElementPos > -1) && (NextEntryPos > -1))
11828 catch(
const Exception &e)
11847 UnicodeString Message = UnicodeString(Train.
HeadCode) +
" will be removed from the railway - proceed?";
11848 int button = Application->MessageBox(Message.c_str(), L
"Please confirm", MB_YESNO);
11861 AnsiString LocName =
"";
11866 if((LocName ==
"") && (Train.
MidElement > -1))
11874 if((LocName ==
"") && (Train.
MidElement > -1))
11921 int FirstRouteElementVecPos = LeadTrackElement.
Conn[Train.
LeadExitPos];
11931 bool FirstPass =
true;
11938 if(FirstPass && (TVPos2 != FirstRouteElementVecPos))
12017 catch(
const Exception &e)
12032 Application->Terminate();
12046 catch(
const Exception &e)
12074 UnicodeString MessStr =
"";
12077 MessStr = UnicodeString(
"The railway and the timetable have both changed, exit without saving either?");
12081 MessStr = UnicodeString(
"The railway has changed, exit without saving?");
12085 MessStr = UnicodeString(
"The timetable has changed, exit without saving?");
12087 int button = Application->MessageBox(MessStr.c_str(), L
"Please confirm", MB_YESNO);
12099 UnicodeString MessageStr =
"Please note that the session will be lost if it hasn't been saved. Do you still wish to exit?";
12102 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
12121 catch(
const Exception &e)
12135 if((Shift.Contains(ssAlt)) && (Shift.Contains(ssCtrl)))
12148 else if(Key ==
'3')
12160 else if(Key ==
'4')
12164 else if(Key ==
'5')
12166 TMsgDlgButtons Buttons;
12167 Buttons << mbYes << mbNo;
12168 if(MessageDlg(
"Do you wish to allow facing signals next to bridges? If so please be aware that routes cannot be truncated to these signals.",
12169 mtWarning, Buttons, 0) == mrYes)
12179 else if(Shift.Contains(ssCtrl) && !Shift.Contains(ssShift) && !Shift.Contains(ssAlt))
12183 else if(Shift.Contains(ssShift) && !Shift.Contains(ssCtrl) && !Shift.Contains(ssAlt))
12195 if((Key != VK_SHIFT) && (Key != VK_CONTROL))
12213 else if(Key == VK_DOWN)
12220 else if(Key == VK_LEFT)
12227 else if(Key == VK_RIGHT)
12234 else if(Key == VK_HOME)
12242 else if(Key == VK_END)
12249 else if(Key == VK_END)
12264 if(Shift.Contains(ssShift) && !Shift.Contains(ssAlt) && !Shift.Contains(ssCtrl) &&
NewHomeButton->Enabled &&
NewHomeButton->Visible)
12275 if(!Shift.Contains(ssCtrl))
12339 if(Key ==
'S' || Key ==
's')
12350 if(Shift.Contains(ssShift))
12365 if(Shift.Contains(ssShift) && !Shift.Contains(ssCtrl) && !Shift.Contains(ssAlt))
12412 if(Shift.Contains(ssCtrl) && !Shift.Contains(ssShift) && !Shift.Contains(ssAlt))
12418 if(Key ==
'S' || Key ==
's')
12424 if(!Shift.Contains(ssCtrl) && !Shift.Contains(ssShift) && !Shift.Contains(ssAlt))
12435 if(!Shift.Contains(ssShift) && !Shift.Contains(ssCtrl))
12442 if(!Shift.Contains(ssShift) && Shift.Contains(ssCtrl))
12448 if(Key ==
'S' || Key ==
's')
12454 if(Shift.Contains(ssShift) && !Shift.Contains(ssCtrl))
12475 if(!Shift.Contains(ssShift) && !Shift.Contains(ssCtrl))
12482 if(Shift.Contains(ssShift) && !Shift.Contains(ssCtrl))
12488 if(Key ==
'S' || Key ==
's')
12493 else if(Key ==
'H' || Key ==
'h')
12506 if(Shift.Contains(ssShift) && !Shift.Contains(ssCtrl))
12577 if(
SaveTTButton->Enabled && (Key ==
'T' || Key ==
't'))
12600 if(
FloatingInfoMenu->Enabled && !Shift.Contains(ssAlt) && Shift.Contains(ssCtrl) && Shift.Contains(ssShift))
12602 if(Key ==
'I' || Key ==
'i')
12608 if(Key ==
'S' || Key ==
's')
12612 else if(Key ==
'T' || Key ==
't')
12621 catch(
const Exception &e)
12631 if((Key != VK_SHIFT) && (Key != VK_CONTROL))
12753 catch(
const Exception &e)
12766 Application->HelpKeyword(u
"Introduction");
12768 catch(
const Exception &e)
12778 const UnicodeString Link =
"http://www.railwayoperationsimulator.com";
12779 ::ShellExecute(Handle, NULL, (Link).c_str(), NULL, NULL, SW_SHOWNORMAL);
12802 catch(
const Exception &e)
12828 catch(
const Exception &e)
12854 catch(
const Exception &e)
12910 bool ErrorFlag =
false, TooBigFlag =
false;
12931 if(!ErrorFlag && !TooBigFlag)
12941 int KPH = (MPH * 1.609344) + 0.5;
12948 int MPH = (KPH * 0.621371) + 0.5;
12959 catch(
const EConvertError &ec)
12964 catch(
const Exception &e)
12999 bool ErrorFlag =
false, TooBigFlag =
false;
13020 if(!ErrorFlag && !TooBigFlag)
13030 int KW = (HP * 0.745699872) + 0.5;
13037 int HP = (KW * 1.340482574) + 0.5;
13048 catch(
const EConvertError &ec)
13053 catch(
const Exception &e)
13066 bool ErrorFlag =
false, TooBigFlag =
false;
13087 if(!ErrorFlag && !TooBigFlag)
13097 int KPH = (MPH * 1.609344) + 0.5;
13104 int MPH = (KPH * 0.621371) + 0.5;
13115 catch(
const EConvertError &ec)
13120 catch(
const Exception &e)
13134 bool ErrorFlag =
false, TooLongFlag =
false;
13137 for(
int x = 1; x <=
MileEdit->Text.Length(); x++)
13149 for(
int x = 1; x <=
ChainEdit->Text.Length(); x++)
13161 for(
int x = 1; x <=
YardEdit->Text.Length(); x++)
13173 TooLongFlag =
true;
13176 if(!ErrorFlag && !TooLongFlag)
13178 int Miles = 0, Chains = 0, Yards = 0, Metres = 0;
13191 Metres = int((Miles * 1609.344) + (Chains * 20.1168) + (Yards * 0.9144) + 0.5);
13200 catch(
const EConvertError &ec)
13205 catch(
const Exception &e)
13236 catch(
const Exception &e)
13273 "Changes have been made to the timetable clock - you may wish to save a session before resuming operation.\n\nTo cancel all changes re-click the 'Adjust the timetable clock' button then click the reset button BEFORE resuming operation.";
13282 catch(
const Exception &e)
13300 catch(
const Exception &e)
13319 catch(
const Exception &e)
13338 catch(
const Exception &e)
13357 catch(
const Exception &e)
13376 catch(
const Exception &e)
13395 catch(
const Exception &e)
13414 catch(
const Exception &e)
13434 catch(
const Exception &e)
13453 catch(
const Exception &e)
13467 double TTClockIncrement = 1.0 / 24;
13473 catch(
const Exception &e)
13487 double TTClockIncrement = 1.0 / 144;
13493 catch(
const Exception &e)
13507 double TTClockIncrement = 1.0 / 1440;
13513 catch(
const Exception &e)
13570 catch(
const Exception &e)
13584 InfoPanel->Caption =
"PRE-START: Presetting automatic signal routes";
13595 Screen->Cursor = TCursor(-11);
13597 bool PointsChanged, AtLeastOneSet =
false;
13598 int LastIteratorValue = 0;
13607 AtLeastOneSet =
true;
13624 ShowMessage(
"No presettable automatic signal routes are available");
13626 Screen->Cursor = TCursor(-2);
13629 catch(
const Exception &e)
13644 int DispW = (
Interface->Width - 64 - 16) / 16;
13646 int DispH = (
Interface->Height - 192) / 16;
13678 catch(
const Exception &e)
13708 catch(
const Exception &e)
13734 SigImagePanel->Caption =
"Signals will be on the right hand side of the track";
13739 std::ofstream SigFile((
CurDir +
"\\Signal.hnd").c_str());
13742 ShowMessage(
"Failed to store right hand signal setting, program will default to left hand signals when next loaded");
13760 SigImagePanel->Caption =
"Signals will be on the left hand side of the track";
13765 std::ofstream SigFile((
CurDir +
"\\Signal.hnd").c_str());
13777 catch(
const Exception &e)
13796 bool TooBigFlag =
false, BadCharsFlag =
false;
13801 for(
int x = 1; x <=
MTBFEditBox->Text.Length(); x++)
13805 BadCharsFlag =
true;
13818 ShowMessage(
"Maximum value allowed is 10,000");
13827 ShowMessage(
"Value must be a whole number with no special characters");
13844 catch(
const Exception &e)
13862 "Values can only be entered or changed in Pre-Start mode\ni.e. after selecting 'Operate railway' but before clicking 'Run'");
13866 catch(
const Exception &e)
13899 catch(
const Exception &e)
13925 catch(
const Exception &e)
13941 catch(
const Exception &e)
13962 catch(
const Exception &e)
13986 catch(
const Exception &e)
14003 catch(
const Exception &e)
14020 catch(
const Exception &e)
14036 ShowMessage(
"No boxes ticked!");
14040 Screen->Cursor = TCursor(-11);
14041 AnsiString TTTitle;
14055 ShowMessage(
"Analysis complete and file created");
14060 Screen->Cursor = TCursor(-2);
14063 catch(
const Exception &e)
14105 int WidthNum = int(
MainScreen->Width / 160) + 1;
14106 int HeightNum = int(
MainScreen->Height / 144) + 1;
14107 for(
int x = 0; x < WidthNum; x++)
14109 for(
int y = 0; y < HeightNum; y++)
14214 bool BreakFlag =
false;
14323 ZoomButton->Glyph->LoadFromResourceName(0,
"ZoomOut");
14357 InfoPanel->Caption =
"CONNECTING GAPS: Click on connecting element";
14373 UnicodeString MessageStr =
"The railway has changed, close it without saving?";
14374 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
14423 std::ifstream VecFile(FileName);
14425 if(VecFile.is_open())
14445 bool GraphicsFollow =
false;
14446 int NumberOfActiveElements;
14459 if(!(EveryPrefDir->CheckOnePrefDir(0, NumberOfActiveElements, VecFile)))
14490 TDateTime First, Second;
14491 bool Finished =
false;
14493 First = TDateTime::CurrentDateTime();
14494 double TimeVal1 = 86400000 * double(First);
14498 Second = TDateTime::CurrentDateTime();
14499 double TimeVal2 = 86400000 * double(Second);
14500 if((TimeVal2 - TimeVal1) > Msec)
14560 if((LinkNumber1 == 1) || (LinkNumber1 == 3) || (LinkNumber1 == 7) || (LinkNumber1 == 9))
14568 if((LinkNumber2 == 1) || (LinkNumber2 == 3) || (LinkNumber2 == 7) || (LinkNumber2 == 9))
14720 InfoPanel->Caption =
"Select an option from the File, Mode or Help menus";
14879 Screen->Cursor = TCursor(-11);
14887 InfoPanel->Caption =
"PREFERRED DIRECTION SETTING: Select preferred direction start location (right click to erase)";
14912 Screen->Cursor = TCursor(-2);
14954 MTBFLabel->Caption =
"Mean time between\ntrain failures in\ntimetable hours";
14967 OperateButton->Glyph->LoadFromResourceName(0,
"RunGraphic");
14994 ShowMessage(
"Performance logfile failed to open, logs won't be saved. Ensure that there is a folder named " +
PERFLOG_DIR_NAME +
14995 " in the folder where the 'Railway.exe' program file resides");
15041 OAListBox->Items->Add(L
"locate train");
15045 OAListBox->Items->Add(L
"headcode for");
15049 OAListBox->Items->Add(L
"Left click and");
15050 OAListBox->Items->Add(L
"hold grey area");
15051 OAListBox->Items->Add(L
"to move panel");
15085 OperateButton->Glyph->LoadFromResourceName(0,
"RunGraphic");
15110 OAListBox->Items->Add(L
"locate train");
15114 OAListBox->Items->Add(L
"headcode for");
15118 OAListBox->Items->Add(L
"Left click and");
15119 OAListBox->Items->Add(L
"hold grey area");
15120 OAListBox->Items->Add(L
"to move panel");
15134 MTBFLabel->Caption =
"Mean time between\ntrain failures in\ntimetable hours";
15143 MTBFLabel->Caption =
"Mean time between\ntrain failures in\ntimetable hours";
15180 InfoPanel->Caption =
"ADDING TRACK: Select element then left click to add it. Right click an element to remove it.";
15218 InfoPanel->Caption =
"ADDING GRAPHIC: Left click layout to add SELECTED graphic, right click to remove ANY graphic.";
15223 InfoPanel->Caption =
"SELECTING USER GRAPHIC: Select the graphic file then add as many as necessary to the layout.";
15227 int HLoc, VLoc, Count;
15229 if(div(Count, 2).rem == 1)
15231 ShowMessage(
"Can't connect, there are an odd number of gaps");
15246 ShowMessage(
"Error - Even number of gaps but all set after first call to HighLightOneGap");
15256 InfoPanel->Caption =
"CONNECTING GAPS: Click on connecting gap";
15263 InfoPanel->Caption =
"ADDING/EDITING TEXT: Left click to add, right click first letter to erase, or left click first letter to edit)";
15278 InfoPanel->Caption =
"MOVING TEXT OR GRAPHIC: If text left click first letter, if graphic left click anywhere, then drag";
15285 InfoPanel->Caption =
"NAMING LOCATIONS: Click on location element to add or change name";
15293 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Select first location (only non-default elements marked)";
15305 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Select next location";
15309 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Continue or set values (overall length), or right click to cancel/truncate";
15324 InfoPanel->Caption =
"SELECTING: Select area - click left mouse && drag";
15334 InfoPanel->Caption =
"COPYING: Left click in selection && drag";
15360 bool EraseSuccessfulFlag, NeedToLink =
false, TextChangesMade =
false, GraphicChangesMade =
false;
15361 int ErasedTrackVectorPosition;
15362 Screen->Cursor = TCursor(-11);
15364 InfoPanel->Caption =
"CUT PROCESSING: Please do not click the mouse";
15371 if(EraseSuccessfulFlag)
15373 if(ErasedTrackVectorPosition > -1)
15386 int HighSelectVPos =
SelectRect.bottom * 16;
15392 if((TextPtr->HPos >= LowSelectHPos) && (TextPtr->HPos < HighSelectHPos) && (TextPtr->VPos >= LowSelectVPos) && (TextPtr->VPos <
15400 TextChangesMade =
true;
15410 if((GraphicPtr->HPos >= LowSelectHPos) && ((GraphicPtr->HPos + GraphicPtr->Width) < HighSelectHPos) && (GraphicPtr->VPos >= LowSelectVPos)
15411 && ((GraphicPtr->VPos + GraphicPtr->Height) < HighSelectVPos))
15414 GraphicChangesMade =
true;
15421 Screen->Cursor = TCursor(-2);
15428 InfoPanel->Caption =
"CUTTING: Left click in selection && drag";
15445 if(NeedToLink || TextChangesMade || GraphicChangesMade)
15473 UnicodeString MessageStr =
15474 "Please be aware of the relevant conditions when pasting " "a railway segment from a different application.\n"
15475 "These are set out in section 3.5 of the manual and " "on-screen help under the heading 'Pasting in an application "
15476 "after cutting or copying from a different application'.\n\n" "This warning will not be shown again.\n\n" "Proceed?";
15477 int button = Application->MessageBox(MessageStr.c_str(), L
"Warning", MB_YESNO | MB_ICONWARNING);
15489 Application->MessageBoxW(L
"Unable to paste, clipboard is corrupt or does not contain a valid railway segment", L
"Warning", MB_OK | MB_ICONWARNING);
15502 Clipboard()->Clear();
15503 Clipboard()->Close();
15506 bool NeedToLink =
false;
15507 bool TrackLinkingRequiredFlag;
15508 Screen->Cursor = TCursor(-11);
15510 InfoPanel->Caption =
"PASTING: Please wait";
15517 bool TrackEraseSuccessfulFlag;
15518 int ErasedTrackVectorPosition;
15520 for(
int x = LowSelectHLoc; x < HighSelectHLoc; x++)
15522 for(
int y = LowSelectVLoc; y < HighSelectVLoc; y++)
15525 if(ErasedTrackVectorPosition > -1)
15542 if((TextPtr->HPos >= LowSelectHPos) && (TextPtr->HPos < HighSelectHPos) && (TextPtr->VPos >= LowSelectVPos) && (TextPtr->VPos <
15559 if((GraphicPtr->HPos >= LowSelectHPos) && ((GraphicPtr->HPos + GraphicPtr->Width) < HighSelectHPos) && (GraphicPtr->VPos >= LowSelectVPos)
15560 && ((GraphicPtr->VPos + GraphicPtr->Height) < HighSelectVPos))
15574 AnsiString LocName;
15593 int HPos = 0, VPos = 0;
15606 bool InternalChecks =
false;
15610 TrackLinkingRequiredFlag, InternalChecks);
15626 if(TrackLinkingRequiredFlag)
15641 PDVIt->HLoc += HDiff;
15642 PDVIt->VLoc += VDiff;
15647 throw Exception(
"Failed to find TrackVectorPosition in PrefDir setting for Paste");
15649 PDVIt->SetTrackVectorPosition(ATVecPos);
15652 for(
int x = 0; x < 4; x++)
15654 PDVIt->Conn[x] = -1;
15655 PDVIt->ConnLinkPos[x] = -1;
15667 TextPtr->HPos += HDiff * 16;
15668 TextPtr->VPos += VDiff * 16;
15669 AnsiString TempString = TextPtr->TextString;
15685 if(TextPtr->TextString.SubString(1, 4) ==
"##**")
15687 TempString = TextPtr->TextString.SubString(5, TextPtr->TextString.Length());
15690 TextPtr->TextString =
"";
15703 for(TTrack::TUserGraphicVector::iterator GraphicPtr =
Track->
SelectGraphicVector.begin(); GraphicPtr < Track->SelectGraphicVector.end();
15706 GraphicPtr->HPos += HDiff * 16;
15707 GraphicPtr->VPos += VDiff * 16;
15722 Screen->Cursor = TCursor(-2);
15742 UnicodeString MessageStr =
"Selected area will be deleted - proceed?";
15743 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
15748 bool EraseSuccessfulFlag, NeedToLink =
false, TextChangesMade =
false, GraphicChangesMade =
false;
15749 int ErasedTrackVectorPosition;
15750 Screen->Cursor = TCursor(-11);
15752 InfoPanel->Caption =
"DELETING: Please wait";
15759 if(EraseSuccessfulFlag)
15761 if(ErasedTrackVectorPosition > -1)
15773 int HighSelectVPos =
SelectRect.bottom * 16;
15779 AnsiString Check = TextPtr->TextString;
15780 if((TextPtr->HPos >= LowSelectHPos) && (TextPtr->HPos < HighSelectHPos) && (TextPtr->VPos >= LowSelectVPos) && (TextPtr->VPos <
15788 TextChangesMade =
true;
15807 if((GraphicPtr->HPos >= LowSelectHPos) && ((GraphicPtr->HPos + GraphicPtr->Width) < HighSelectHPos) && (GraphicPtr->VPos >= LowSelectVPos)
15808 && ((GraphicPtr->VPos + GraphicPtr->Height) < HighSelectVPos))
15813 if((UserGraphicPtr->HPos == GraphicPtr->HPos) && (UserGraphicPtr->VPos == GraphicPtr->VPos) &&
15814 (UserGraphicPtr->Width == GraphicPtr->Width) && (UserGraphicPtr->Height == GraphicPtr->Height) &&
15815 (UserGraphicPtr->FileName == GraphicPtr->FileName))
15818 GraphicChangesMade =
true;
15838 if(NeedToLink || TextChangesMade || GraphicChangesMade)
15842 Screen->Cursor = TCursor(-2);
15894 bool LeadingPointsAtLastElement =
false;
15897 if(LeadingPointsAtLastElement)
15899 InfoPanel->Caption =
"PREFERRED DIRECTION SETTING: Can't end on leading points, select next location or truncate";
15904 InfoPanel->Caption =
"PREFERRED DIRECTION SETTING: Select next preferred direction location (right click to truncate)";
15909 InfoPanel->Caption =
"PREFERRED DIRECTION SETTING: Add selection or select next location (right click to truncate)";
15924 InfoPanel->Caption =
"SELECTING: Select area - click left mouse && drag";
15965 OperateButton->Glyph->LoadFromResourceName(0,
"PauseGraphic");
16039 Display->
PerformanceLog(15, TimeMessage +
"Timetable clock speed changed to one sixteenth normal");
16047 if(TTClockTimeChange > 0.000347)
16050 int MinsIncrease = ((TTClockTimeChange * 1440) + 0.5);
16051 int HoursIncrease = 0;
16052 while(MinsIncrease >= 60)
16055 MinsIncrease -= 60;
16057 if(HoursIncrease == 0)
16059 TimeMessage +=
"Timetable clock incremented by " + AnsiString(MinsIncrease) +
"m";
16061 else if(MinsIncrease == 0)
16063 TimeMessage +=
"Timetable clock incremented by " + AnsiString(HoursIncrease) +
"h";
16067 TimeMessage +=
"Timetable clock incremented by " + AnsiString(HoursIncrease) +
"h " + AnsiString(MinsIncrease) +
"m";
16079 MTBFLabel->Caption =
"Mean time between\ntrain failures in\ntimetable hours";
16087 MTBFLabel->Caption =
"Mean time between\ntrain failures in\ntimetable hours";
16096 OperateButton->Glyph->LoadFromResourceName(0,
"RunGraphic");
16124 float LockDelay = 120.0;
16130 bool BreakFlag =
false;
16134 if((TTClockTime - LRVIT->LockStartTime) > TDateTime(LockDelay / 86400))
16137 AnsiString(LRVIT->LastTrackVectorPosition));
16138 while(Route.
LastElementPtr(9)->GetTrackVectorPosition() != LRVIT->TruncateTrackVectorPosition)
16155 if(Route.
LastElementPtr(17)->GetTrackVectorPosition() == LRVIT->TruncateTrackVectorPosition)
16196 int TempLockedVectorNumber;
16206 if(((TTClockTime - AutoSigVectorIT->PassoutTime) > TDateTime(AutoSigVectorIT->FirstDelay / 86400)) && (AutoSigVectorIT->AccessNumber == 0))
16209 AutoSigVectorIT->AccessNumber++;
16212 if(((TTClockTime - AutoSigVectorIT->PassoutTime) > TDateTime(AutoSigVectorIT->SecondDelay / 86400)) && (AutoSigVectorIT->AccessNumber == 1))
16215 AutoSigVectorIT->AccessNumber++;
16218 if(((TTClockTime - AutoSigVectorIT->PassoutTime) > TDateTime(AutoSigVectorIT->ThirdDelay / 86400)) && (AutoSigVectorIT->AccessNumber == 2))
16221 AutoSigVectorIT->AccessNumber++;
16229 if(AutoSigVectorIT->AccessNumber > 2)
16243 TPoint MousePoint = Mouse->CursorPos;
16244 int ScreenX = MousePoint.x -
MainScreen->ClientOrigin.x;
16245 int ScreenY = MousePoint.y -
MainScreen->ClientOrigin.y;
16257 ((MousePoint.y - ClientOrigin.y) >=
PerformancePanel->Top) && ((MousePoint.y - ClientOrigin.y) <=
16269 ((MousePoint.y - ClientOrigin.y) >=
TimetableEditPanel->Top) && ((MousePoint.y - ClientOrigin.y) <=
16278 AnsiString TrackFloat =
"", TrainStatusFloat =
"", TrainTTFloat =
"";
16279 bool ShowTrackFloatFlag =
false, ShowTrainStatusFloatFlag =
false, ShowTrainTTFloatFlag =
false;
16289 bool MouseOverOAPanel =
false;
16294 ((MousePoint.y - ClientOrigin.y) >=
OperatorActionPanel->Top) && ((MousePoint.y - ClientOrigin.y) <=
16297 MouseOverOAPanel =
true;
16303 bool ActiveTrackFoundFlag =
false, InactiveTrackFoundFlag =
false, TwoTrack =
false;
16304 AnsiString Length01Str =
"", Length23Str =
"", SpeedLimit01Str =
"", SpeedLimit23Str =
"";
16305 AnsiString StationEntryStopLinkPos1Str =
"", StationEntryStopLinkPos2Str =
"";
16306 AnsiString ATrackSN =
"", ATrackTN =
"", IATrackSN =
"", LengthAndSpeedCaption =
"";
16307 AnsiString SigAspectString =
"";
16311 if(InactiveTrackFoundFlag)
16316 if(ActiveTrackFoundFlag)
16323 if((ATrackTN !=
"") && (!InactiveTrackFoundFlag || ((InactiveTrackElement.
TrackType !=
Platform) &&
16327 ShowMessage(
"Error - Track has timetable name without corresponding plat/named loc");
16332 ShowMessage(
"Error - plat/named loc and track have different names, or plat/named loc named but not track");
16338 Length01Str = AnsiString(ActiveTrackElement.
Length01);
16339 if(Length01Str ==
"-1")
16341 Length01Str =
"Not Set";
16343 SpeedLimit01Str = AnsiString(ActiveTrackElement.
SpeedLimit01);
16344 if(SpeedLimit01Str ==
"-1")
16346 SpeedLimit01Str =
"Not Set";
16350 Length23Str = AnsiString(ActiveTrackElement.
Length23);
16351 if(Length23Str ==
"-1")
16353 Length23Str =
"Not Set";
16355 SpeedLimit23Str = AnsiString(ActiveTrackElement.
SpeedLimit23);
16356 if(SpeedLimit23Str ==
"-1")
16358 SpeedLimit23Str =
"Not Set";
16362 LengthAndSpeedCaption =
"Straight track length = " + Length01Str +
" m" +
'\n' +
"Diverging track length = " + Length23Str +
" m" +
'\n' +
16363 "Straight track speed limit = " + SpeedLimit01Str +
" km/h" +
'\n' +
"Diverging track speed limit = " + SpeedLimit23Str +
" km/h";
16367 LengthAndSpeedCaption =
"Left diverging track length = " + Length01Str +
" m" +
'\n' +
"Right diverging track length = " + Length23Str +
16368 " m" +
'\n' +
"Left diverging track speed limit = " + SpeedLimit01Str +
" km/h" +
'\n' +
"Right diverging track Speed Limit = " +
16369 SpeedLimit23Str +
" km/h";
16374 if((ActiveTrackElement.
SpeedTag == 15) || (ActiveTrackElement.
SpeedTag == 46))
16376 LengthAndSpeedCaption =
"Horizontal track length = " + Length01Str +
" m" +
'\n' +
"Other track length = " + Length23Str +
" m" +
'\n' +
16377 "Horizontal track speed limit = " + SpeedLimit01Str +
" km/h" +
'\n' +
"Other track speed limit = " + SpeedLimit23Str +
" km/h";
16379 else if(ActiveTrackElement.
SpeedTag == 47)
16381 LengthAndSpeedCaption =
"Horizontal track length = " + Length23Str +
" m" +
'\n' +
"Other track length = " + Length01Str +
" m" +
'\n' +
16382 "Horizontal track speed limit = " + SpeedLimit23Str +
" km/h" +
'\n' +
"Other track speed limit = " + SpeedLimit01Str +
" km/h";
16384 else if(ActiveTrackElement.
SpeedTag == 45)
16386 LengthAndSpeedCaption =
"Vertical track length = " + Length01Str +
" m" +
'\n' +
"Other track length = " + Length23Str +
" m" +
'\n' +
16387 "Vertical track speed limit = " + SpeedLimit01Str +
" km/h" +
'\n' +
"Other track speed limit = " + SpeedLimit23Str +
" km/h";
16389 else if(ActiveTrackElement.
SpeedTag == 44)
16391 LengthAndSpeedCaption =
"Vertical track length = " + Length23Str +
" m" +
'\n' +
"Other track length = " + Length01Str +
" m" +
'\n' +
16392 "Vertical track speed limit = " + SpeedLimit23Str +
" km/h" +
'\n' +
"Other track speed limit = " + SpeedLimit01Str +
" km/h";
16394 else if(ActiveTrackElement.
SpeedTag == 16)
16396 LengthAndSpeedCaption =
"Top left to bottom right track length = " + Length01Str +
" m" +
'\n' +
"Other track length = " + Length23Str +
16397 " m" +
'\n' +
"Top left to bottom right track speed limit = " + SpeedLimit01Str +
" km/h" +
'\n' +
"Other track speed limit = " +
16398 SpeedLimit23Str +
" km/h";
16403 LengthAndSpeedCaption =
"Top track length = " + Length01Str +
" m" +
'\n' +
"Bottom track length = " + Length23Str +
" m" +
'\n' +
16404 "Top track speed limit = " + SpeedLimit01Str +
" km/h" +
'\n' +
"Bottom track speed limit = " + SpeedLimit23Str +
" km/h";
16409 LengthAndSpeedCaption =
"Track length = " + Length01Str +
" m" +
'\n' +
"Track speed limit = " + SpeedLimit01Str +
" km/h";
16412 if(ActiveTrackFoundFlag)
16416 ShowTrackFloatFlag =
true;
16419 TrackFloat =
"Location = " + ATrackTN +
'\n' + LengthAndSpeedCaption +
'\n' +
"ID = " + AnsiString(ActiveTrackElement.
ElementID);
16421 else if(ATrackSN !=
"")
16423 TrackFloat =
"Location = " + ATrackSN +
'\n' + LengthAndSpeedCaption +
'\n' +
"ID = " + AnsiString(ActiveTrackElement.
ElementID);
16426 else if(InactiveTrackFoundFlag)
16428 TrackFloat =
"Location unnamed\n" + LengthAndSpeedCaption +
'\n' +
"ID = " + AnsiString(ActiveTrackElement.
ElementID);
16433 TrackFloat = LengthAndSpeedCaption +
'\n' +
"Track Element ID = " + AnsiString(ActiveTrackElement.
ElementID);
16439 SigAspectString =
"\nThree-aspect signal";
16443 SigAspectString =
"\nTwo-aspect signal";
16447 SigAspectString =
"\nGround signal";
16451 SigAspectString =
"\nFour-aspect signal";
16453 TrackFloat += SigAspectString;
16456 else if(InactiveTrackFoundFlag)
16459 ShowTrackFloatFlag =
true;
16462 if(IATrackSN ==
"")
16464 TrackFloat =
"Location unnamed\nID = " + AnsiString(InactiveTrackElement.
ElementID);
16468 TrackFloat =
"Location = " + IATrackSN +
'\n' +
"ID = " + AnsiString(InactiveTrackElement.
ElementID);
16473 TrackFloat =
"ID = " + AnsiString(InactiveTrackElement.
ElementID);
16479 bool OAListBoxFloatRequired =
false;
16484 AnsiString FormatOneDPStr =
"####0.0";
16485 AnsiString FormatNoDPStr =
"#######0";
16487 AnsiString MaxBrakeStr =
"";
16488 AnsiString SpecialStr =
"";
16493 int X =
OAListBox->ScreenToClient(MousePoint).x;
16494 int Y =
OAListBox->ScreenToClient(MousePoint).y;
16495 int TrainID = -1, ContinuationPos = -1;
16498 OAListBoxFloatRequired =
true;
16501 ShowTrainStatusFloatFlag =
true;
16505 ShowTrainTTFloatFlag =
true;
16507 if((TrainID > -1) && (ShowTrainStatusFloatFlag || ShowTrainTTFloatFlag))
16513 else if(ContinuationPos > -1)
16520 if(!OAListBoxFloatRequired)
16523 if(FoundFlag && !MouseOverOAPanel)
16531 ShowTrainStatusFloatFlag =
true;
16536 ShowTrainTTFloatFlag =
true;
16546 TrainStatusFloat =
"No trains expected";
16547 TrainTTFloat =
"No timetable";
16550 ShowTrainStatusFloatFlag =
true;
16554 ShowTrainTTFloatFlag =
true;
16565 AnsiString Caption;
16567 if(!ShowTrackFloatFlag && !ShowTrainStatusFloatFlag && !ShowTrainTTFloatFlag)
16573 else if(ShowTrackFloatFlag && !ShowTrainStatusFloatFlag && !ShowTrainTTFloatFlag)
16575 Caption = TrackFloat;
16577 else if(!ShowTrackFloatFlag && ShowTrainStatusFloatFlag && !ShowTrainTTFloatFlag)
16579 Caption = TrainStatusFloat;
16581 else if(ShowTrackFloatFlag && ShowTrainStatusFloatFlag && !ShowTrainTTFloatFlag)
16583 Caption = TrainStatusFloat +
'\n' +
'\n' + TrackFloat;
16585 else if(!ShowTrackFloatFlag && !ShowTrainStatusFloatFlag && ShowTrainTTFloatFlag)
16587 if(TrainStatusFloat ==
"No trains expected")
16589 Caption = TrainStatusFloat;
16593 Caption = TrainTTFloat;
16596 else if(ShowTrackFloatFlag && !ShowTrainStatusFloatFlag && ShowTrainTTFloatFlag)
16598 if(TrainStatusFloat ==
"No trains expected")
16600 Caption = TrainStatusFloat +
'\n' +
'\n' + TrackFloat;
16604 Caption = TrainTTFloat +
'\n' +
'\n' + TrackFloat;
16607 else if(!ShowTrackFloatFlag && ShowTrainStatusFloatFlag && ShowTrainTTFloatFlag)
16609 if(TrainStatusFloat ==
"No trains expected")
16611 Caption = TrainStatusFloat;
16615 Caption = TrainStatusFloat +
'\n' +
'\n' + TrainTTFloat;
16618 else if(ShowTrackFloatFlag && ShowTrainStatusFloatFlag && ShowTrainTTFloatFlag)
16620 if(TrainStatusFloat ==
"No trains expected")
16622 Caption = TrainStatusFloat +
'\n' +
'\n' + TrackFloat;
16626 Caption = TrainStatusFloat +
'\n' +
'\n' + TrainTTFloat +
'\n' +
'\n' + TrackFloat;
16629 int WindowOffsetLeft = 16;
16630 int WindowOffsetRight = 16;
16631 if(OAListBoxFloatRequired)
16633 WindowOffsetLeft = 32;
16634 WindowOffsetRight = 64;
16639 int Left = ScreenX +
MainScreen->Left + WindowOffsetRight;
16644 Left = ScreenX -
FloatingPanel->Width + 32 - WindowOffsetLeft;
16682 AnsiString &TrainTTFloat)
16691 (CTEIt->second.TrainDataEntryPtr->TrainOperatingDataVector.at(CTEIt->second.RepeatNumber).RunningEntry !=
NotStarted)))
16698 AnsiString ServiceReferenceInfo =
"";
16702 if(CTEIt->second.RepeatNumber == 0)
16706 ServiceReferenceInfo =
"\nFirst service of ref. " + TTDEPtr->
ServiceReference;
16710 ServiceReferenceInfo =
"\nFirst service";
16715 ServiceReferenceInfo =
"\nRepeat service no. " + AnsiString(CTEIt->second.RepeatNumber);
16719 ServiceReferenceInfo =
"\nRepeat service no. " + AnsiString(CTEIt->second.RepeatNumber) +
" of ref. " + TTDEPtr->
ServiceReference;
16726 ServiceReferenceInfo =
"\nService reference " + TTDEPtr->
ServiceReference;
16731 SpecialStr =
"\nTrain under signaller control";
16733 if(EntrySpeed > LineSpeedLimit)
16735 EntrySpeed = LineSpeedLimit;
16741 if(EntrySpeed > LineSpeedLimit)
16743 EntrySpeed = LineSpeedLimit;
16748 TDateTime TempTime = CTEIt->first;
16750 TrainStatusFloat = CTEIt->second.HeadCode +
": " + CTEIt->second.Description + ServiceReferenceInfo +
"\nEntry speed " +
16751 AnsiString::FormatFloat(FormatNoDPStr, EntrySpeed) +
"km/h" + SpecialStr +
"\nDelayed, was due at " +
Utilities->
Format96HHMM(TempTime);
16755 TDateTime TempTime = CTEIt->first;
16757 TrainStatusFloat = CTEIt->second.HeadCode +
": " + CTEIt->second.Description + ServiceReferenceInfo +
"\nEntry speed " +
16758 AnsiString::FormatFloat(FormatNoDPStr, EntrySpeed) +
"km/h" + SpecialStr +
"\nExpected at " +
Utilities->
Format96HHMM(TempTime);
16765 CTEIt->second.IncrementalDigits);
16779 AnsiString HeadCode =
"", ServiceReferenceInfo =
"", Status =
"", CurrSpeedStr =
"", BrakePCStr =
"", NextStopStr =
"", TimeLeftStr =
"",
16780 TimeToNextMovementStr =
"", MassStr =
"", PowerStr =
"";
16781 AnsiString FormatOneDPStr =
"####0.0", MaxBrakeStr =
"", MaxSpeedStr =
"", TrainStatusFloat;
16785 MassStr = AnsiString::FormatFloat(FormatNoDPStr, ((
double)Train.
Mass) / 1000);
16786 PowerStr = AnsiString::FormatFloat(FormatNoDPStr, Train.
PowerAtRail / 1000 / 0.8);
16789 MaxSpeedStr =
"30";
16793 MaxSpeedStr = AnsiString::FormatFloat(FormatNoDPStr, Train.
MaxRunningSpeed);
16798 TDateTime TimeLeft;
16800 MaxBrakeStr = AnsiString::FormatFloat(FormatNoDPStr, (Train.
MaxBrakeRate * Train.
Mass / 9810));
16812 ServiceReferenceInfo =
"\nFirst service";
16817 ServiceReferenceInfo =
"\nRepeat service no. " + AnsiString(Train.
RepeatNumber);
16835 Status =
"Stopped on signaller's instruction";
16839 Status =
"Not in service";
16843 Status =
"Stopped at buffers";
16847 Status =
"Stopped at signal";
16851 Status =
"Stopped - forward track occupied";
16865 Status =
"Stopped without power - train failed";
16869 Status =
"Stopped without power";
16874 Status =
"Stopped - signal passed at danger";
16878 Status =
"Derailed";
16882 Status =
"Crashed";
16890 Status =
"Accelerating";
16897 if(BrakePCRate < 55)
16899 Status =
"Light braking";
16901 else if(BrakePCRate < 90)
16903 Status =
"Heavy braking";
16907 Status =
"Emergency braking";
16914 if(BrakePCRate < 55)
16916 Status =
"Light braking";
16918 else if(BrakePCRate < 90)
16920 Status =
"Heavy braking";
16924 Status =
"Emergency braking";
16931 Status =
"Accelerating";
16937 Status =
"Accelerating";
16939 ((Train.
ExitSpeedFull - Train.
ExitSpeedHalf) * (
double(ElapsedDeltaT - FirstHalfTimeDeltaT) / double(SecondHalfTimeDeltaT)));
16948 Status =
"Coasting - train failed";
16952 Status =
"Coasting - no power";
16958 Status =
"Constant speed";
16969 Status =
"Coasting - train failed";
16973 Status =
"Coasting - no power";
16979 Status =
"Constant speed";
16987 NextStopStr =
"At signaller's discretion";
16991 NextStopStr =
"None";
17000 SpecialStr =
"Train under signaller control" + AnsiString(
'\n');
17004 SpecialStr =
"Restricted speed - being called on" + AnsiString(
'\n');
17007 if(RemTimeHalf < 0)
17012 if(RemTimeFull < 0)
17016 if(RemTimeHalf > 0)
17018 TimeLeft = RemTimeHalf;
17022 TimeLeft = RemTimeFull;
17024 TimeToNextMovementStr =
"Time to next movement (sec) = " + TimeLeftStr.FormatFloat(FormatOneDPStr, TimeLeft);
17027 TimeToNextMovementStr =
"";
17031 TrainStatusFloat = HeadCode +
": " + Train.
TrainDataEntryPtr->
Description + ServiceReferenceInfo +
'\n' +
"Maximum train speed " + MaxSpeedStr +
17032 "km/h; Power " + PowerStr +
"kW" +
'\n' +
"Mass " + MassStr +
"Te; Brakes " + MaxBrakeStr +
"Te" +
'\n' + SpecialStr + Status +
'\n' +
"Next: " +
17037 TrainStatusFloat = HeadCode +
": " + Train.
TrainDataEntryPtr->
Description + ServiceReferenceInfo +
'\n' +
"Maximum train speed " + MaxSpeedStr +
17038 "km/h; Power " + PowerStr +
"kW" +
'\n' +
"Mass " + MassStr +
"Te; Brakes " + MaxBrakeStr +
"Te" +
'\n' + SpecialStr + Status +
": " +
17039 CurrSpeedStr.FormatFloat(FormatNoDPStr, CurrSpeed) +
"km/h" +
'\n' +
"Next: " + NextStopStr;
17042 return(TrainStatusFloat);
17121 InfoPanel->Caption =
"PRE-START: Route setting in progress";
17125 InfoPanel->Caption =
"OPERATING: Route setting in progress";
17248 bool Manual =
false;
17297 throw Exception(
"Failed to find a route at LC position HLoc = " + (AnsiString)H +
" VLoc = " + (AnsiString)V);
17302 if(RouteNumber > -1)
17336 bool SaveRailwayButtonsFlag =
true;
17345 SaveRailwayButtonsFlag =
false;
17363 SaveRailwayButtonsFlag =
false;
17371 SaveRailwayButtonsFlag =
false;
17422 bool ZoomFlag =
true, HomeFlag =
true, NewHomeFlag =
true, ScreenLeftFlag =
true, ScreenRightFlag =
true, ScreenUpFlag =
true, ScreenDownFlag =
true,
17423 TrackBuildPanelEnabledFlag =
true, PrefDirPanelEnabledFlag =
true, OperatingPanelEnabledFlag =
true, TimetablePanelEnabledFlag =
true;
17425 AnsiString TrackBuildPanelLabelCaptionStr =
"Build/modify";
17426 AnsiString PrefDirPanelLabelCaptionStr =
"Preferred direction selection";
17427 AnsiString OperatingPanelLabelCaptionStr =
"Operation";
17428 AnsiString TimetablePanelLabelCaptionStr =
"Timetable editor";
17435 ScreenLeftFlag =
false;
17439 ScreenRightFlag =
false;
17443 ScreenUpFlag =
false;
17447 ScreenDownFlag =
false;
17455 ScreenLeftFlag =
false;
17459 ScreenRightFlag =
false;
17463 ScreenUpFlag =
false;
17467 ScreenDownFlag =
false;
17474 NewHomeFlag =
false;
17475 ScreenLeftFlag =
false;
17476 ScreenRightFlag =
false;
17477 ScreenUpFlag =
false;
17478 ScreenDownFlag =
false;
17483 TrackBuildPanelEnabledFlag =
false;
17484 TrackBuildPanelLabelCaptionStr =
"Disabled";
17485 PrefDirPanelEnabledFlag =
false;
17486 PrefDirPanelLabelCaptionStr =
"Disabled";
17487 OperatingPanelEnabledFlag =
false;
17488 OperatingPanelLabelCaptionStr =
"Disabled";
17489 TimetablePanelEnabledFlag =
false;
17490 TimetablePanelLabelCaptionStr =
"Disabled";
17498 OperatingPanelEnabledFlag =
false;
17499 OperatingPanelLabelCaptionStr =
"Disabled";
17502 NewHomeFlag =
false;
17503 ScreenLeftFlag =
false;
17504 ScreenRightFlag =
false;
17505 ScreenUpFlag =
false;
17506 ScreenDownFlag =
false;
17519 NewHomeFlag =
false;
17520 ScreenLeftFlag =
false;
17521 ScreenRightFlag =
false;
17522 ScreenUpFlag =
false;
17523 ScreenDownFlag =
false;
17529 NewHomeFlag =
false;
17530 ScreenLeftFlag =
false;
17531 ScreenRightFlag =
false;
17532 ScreenUpFlag =
false;
17533 ScreenDownFlag =
false;
17540 NewHomeFlag =
false;
17541 ScreenLeftFlag =
false;
17542 ScreenRightFlag =
false;
17543 ScreenUpFlag =
false;
17544 ScreenDownFlag =
false;
17583 if(ScreenRightFlag)
17607 if(OperatingPanelEnabledFlag)
17615 if(TrackBuildPanelEnabledFlag)
17623 if(PrefDirPanelEnabledFlag)
17631 if(TimetablePanelEnabledFlag)
17654 bool CallOnValid =
false;
17660 CallOnValid =
true;
17755 Screen->Cursor = TCursor(-2);
17799 Caption =
"Railway: New railway under development";
17803 Caption =
"Railway: " +
RailwayTitle +
" under development";
17897 TFont *TempFont =
new TFont;
17899 TempFont->Style.Clear();
17900 TempFont->Name =
"MS Sans Serif";
17901 TempFont->Size = 10;
17903 TempFont->Charset = (TFontCharset)(0);
18010 if(NonPrefDirChangesMade)
18035 AnsiString CurrentDateTimeStr =
"", TimetableTimeStr =
"", SessionFileStr =
"";
18036 Screen->Cursor = TCursor(-11);
18037 CurrentDateTimeStr = TDateTime::CurrentDateTime().FormatString(
"dd-mm-yyyy hh.nn.ss");
18040 TimetableTimeStr = TimetableTimeStr.SubString(1, 2) +
'.' + TimetableTimeStr.SubString(4, 2) +
'.' + TimetableTimeStr.SubString(7, 2);
18043 SessionFileStr =
LoadSessionDialog->InitialDir +
"\\Session " + CurrentDateTimeStr +
"; Timetable time " + TimetableTimeStr +
"; " +
RailwayTitle +
18045 std::ofstream SessionFile(SessionFileStr.c_str());
18046 if(!(SessionFile.fail()))
18088 SessionFile.close();
18089 DeleteFile(SessionFileStr);
18090 Screen->Cursor = TCursor(-2);
18138 SessionFile.close();
18149 Screen->Cursor = TCursor(-2);
18152 catch(
const Exception &e)
18185 Screen->Cursor = TCursor(-11);
18190 if(!(SessionFile.fail()))
18197 int LastCharBeforeFloat = TempString.LastDelimiter(
'*');
18198 if((LastCharBeforeFloat == 0) || (LastCharBeforeFloat == TempString.Length()))
18205 AnsiString FloatStr = TempString.SubString(LastCharBeforeFloat + 1, TempString.Length() - LastCharBeforeFloat);
18221 bool GraphicsFollow =
false;
18237 SessionFile.close();
18238 Screen->Cursor = TCursor(-2);
18239 ShowMessage(
"Corruption in preferred direction section of the session file, session can't be loaded");
18247 SessionFile.close();
18248 Screen->Cursor = TCursor(-2);
18249 ShowMessage(
"Corruption in route section of the session file, session can't be loaded");
18261 if(TempString ==
"***BarriersDownVector***")
18269 SessionFile.close();
18270 Screen->Cursor = TCursor(-2);
18271 ShowMessage(
"Unable to load timetable section of the session file, session can't be loaded");
18278 SessionFile.close();
18279 Screen->Cursor = TCursor(-2);
18280 throw Exception(
"TimetableTitle null in LoadSession");
18298 ShowMessage(
"Performance logfile failed to open, logs won't be saved. Ensure that there is a folder named " +
PERFLOG_DIR_NAME +
18299 " in the folder where the 'Railway.exe' program file resides");
18305 SessionFile.get(TempChar);
18306 while(!SessionFile.eof() && ((TempChar ==
'\n') || (TempChar ==
'\0')))
18308 SessionFile.get(TempChar);
18310 if(SessionFile.eof())
18314 SessionFile.close();
18326 double PowerDouble;
18336 SessionFile.get(TempChar);
18337 while(!SessionFile.eof() && ((TempChar ==
'\n') || (TempChar ==
'\0')))
18339 SessionFile.get(TempChar);
18341 if(!SessionFile.eof())
18343 if((TempChar !=
'0') && (TempChar !=
'1'))
18345 throw Exception(
"TempChar value = " + AnsiString(TempChar) +
", should be 0 or 1");
18348 if(TempChar ==
'0')
18355 SessionFile.get(TempChar);
18356 while(!SessionFile.eof() && ((TempChar ==
'\n') || (TempChar ==
'\0')))
18358 SessionFile.get(TempChar);
18360 if(!SessionFile.eof())
18363 AnsiString TempString = TempChar;
18364 SessionFile.get(TempChar);
18365 while((TempChar !=
'\n') && (TempChar !=
'\0'))
18367 TempString = TempString + TempChar;
18368 SessionFile.get(TempChar);
18377 SessionFile.close();
18414 ShowMessage(
"Session file integrity check failed, unable to load " +
LoadSessionDialog->FileName);
18416 Screen->Cursor = TCursor(-2);
18420 catch(
const Exception &e)
18422 if((e.Message.Pos(
"esource") > 0) || (e.Message.Pos(
"arameter") > 0))
18424 Screen->Cursor = TCursor(-2);
18435 UnicodeString MessageStr =
18436 "Insufficient memory available to load the file, and partial load likely to be corrupt. Application will terminate. Try loading the session as the first action after reloading the program.";
18438 Application->MessageBox(MessageStr.c_str(), L
"Out of memory", MB_OK | MB_ICONERROR);
18439 Application->Terminate();
18516 if(OpMode ==
"PreStart")
18578 AnsiString OpMode =
"";
18585 else if((OpMode !=
"PreStart") && (OpMode !=
"NotPreStart"))
18814 SessionFile.close();
18815 SessionFile.open(SessionFileStr.c_str(), std::ios_base::app | std::ios_base::binary);
18829 ShowMessage(
"Failed to open temporary timetable file. Unable to save the session");
18835 char *Buffer =
new char[10000];
18840 BytesRead = FileRead(Handle, Buffer, 10000);
18841 SessionFile.write(Buffer, BytesRead);
18842 if(BytesRead < 10000)
18850 SessionFile.close();
18851 SessionFile.open(SessionFileStr.c_str(), std::ios_base::app | std::ios_base::out);
18875 if(!FileExists(TimetableFileName))
18881 ErrorFile.open(ErrorFileStr.c_str(), std::ios_base::app | std::ios_base::binary);
18883 int Handle = FileOpen(TimetableFileName, fmOpenRead);
18890 Handle = FileOpen(TimetableFileName, fmOpenRead);
18900 char *Buffer =
new char[10000];
18905 BytesRead = FileRead(Handle, Buffer, 10000);
18906 ErrorFile.write(Buffer, BytesRead);
18907 if(BytesRead < 10000)
18916 ErrorFile.open(ErrorFileStr.c_str(), std::ios_base::app | std::ios_base::out);
18944 int TempTTFileNumber = 0;
18946 while(FileExists(
CurDir +
"\\TmpTT" + AnsiString(TempTTFileNumber) +
".tmp"))
18948 TempTTFileNumber++;
18956 if(!TTBFile.fail())
18958 char *Buffer =
new char[10000];
18959 char TempChar = (char)(SessionFile.peek());
18960 if(TempChar ==
'\n')
18962 SessionFile.get(TempChar);
18964 if(!SessionFile.getline(Buffer, 10000,
'\0'))
18973 for(
int x = 0; x < 10000; x++)
18975 if(Buffer[x] !=
'\0')
18984 while(AnsiString(Buffer) !=
"***End***")
18986 TTBFile.write(Buffer, Count);
18987 TTBFile.write(&Zero, 1);
18989 if(!SessionFile.getline(Buffer, 10000,
'\0'))
18998 for(
int x = 0; x < 10000; x++)
19000 if(Buffer[x] !=
'\0')
19014 bool GiveMessagesFalse =
false;
19015 bool CheckLocationsExistInRailwayTrue =
true;
19018 std::ifstream TTBLFile(
TempTTFileName.c_str(), std::ios_base::binary);
19019 if(TTBLFile.is_open())
19021 bool SessionFileTrue =
true;
19052 for(
int x = 0; x < NumberOfTrainEntries; x++)
19060 for(
int y = 0; y < NumberOfTrains; y++)
19085 AnsiString OutString;
19092 while(OutString !=
"***End***")
19101 if(SessionFile.fail())
19106 int NumberOfTrainEntries;
19113 for(
int x = 0; x < NumberOfTrainEntries; x++)
19115 int NumberOfTrains;
19121 for(
int y = 0; y < NumberOfTrains; y++)
19150 bool EndOfFile =
false;
19152 char *TrainTimetableString =
new char[10000];
19156 TTBLFile.getline(TrainTimetableString, 10000,
'\0');
19157 if(TTBLFile.eof() && (TrainTimetableString[0] ==
'\0'))
19164 AnsiString OneLine(TrainTimetableString);
19165 bool FinalCallTrue =
true;
19167 CheckLocationsExistInRailway))
19169 TTBLFile.getline(TrainTimetableString, 10000,
'\0');
19170 if(TTBLFile.eof() && (TrainTimetableString[0] ==
'\0'))
19173 throw Exception(
"Timetable FinalCall error - no start time on own line, Count = 0");
19175 OneLine = AnsiString(TrainTimetableString);
19181 TTBLFile.getline(TrainTimetableString, 10000,
'\0');
19182 if(TTBLFile.eof() && (TrainTimetableString[0] ==
'\0'))
19189 OneLine = AnsiString(TrainTimetableString);
19195 throw Exception(
"Timetable FinalCall error in processing one timetable line, Count = " + AnsiString(Count));
19197 if(EndOfFile && (Count < 2))
19200 throw Exception(
"Timetable FinalCall error - too few or no relevant entries, Count = " + AnsiString(Count));
19205 delete[]TrainTimetableString;
19206 bool TwoLocationFlag;
19214 ShowMessage(
"Timetable secondary integrity check failed - unable to load");
19251 bool EndOfFile =
false;
19253 char *TrainTimetableString =
new char[10000];
19257 TTBLFile.getline(TrainTimetableString, 10000,
'\0');
19258 if(TTBLFile.eof() && (TrainTimetableString[0] ==
'\0'))
19265 AnsiString OneLine(TrainTimetableString);
19266 bool FinalCallTrue =
true;
19268 CheckLocationsExistInRailway))
19270 TTBLFile.getline(TrainTimetableString, 10000,
'\0');
19271 if(TTBLFile.eof() && (TrainTimetableString[0] ==
'\0'))
19274 throw Exception(
"Timetable FinalCall error - no start time on own line, Count = 0");
19276 OneLine = AnsiString(TrainTimetableString);
19282 TTBLFile.getline(TrainTimetableString, 10000,
'\0');
19283 if(TTBLFile.eof() && (TrainTimetableString[0] ==
'\0'))
19290 OneLine = AnsiString(TrainTimetableString);
19296 throw Exception(
"Timetable FinalCall error in processing one timetable line, Count = " + AnsiString(Count));
19298 if(EndOfFile && (Count < 2))
19301 throw Exception(
"Timetable FinalCall error - too few or no relevant entries, Count = " + AnsiString(Count));
19306 delete[]TrainTimetableString;
19307 bool TwoLocationFlag;
19318 else if(TwoLocationFlag)
19320 AnsiString AllServices =
"", Suffix =
"";
19330 AllServices = AllServices + *TLLIt +
", ";
19336 Suffix =
"(more than 5, first 5 are) ";
19340 TwoLocationNameLabel->Caption =
"The following services have two or more locations with the same name without a change of\n"
19341 "direction between them. If this isn't intended then please correct them.\n\n"
19342 "Before ticking the check box please be sure that all services are correct.\n\n"
19343 "Services: " + Suffix +
" " + AllServices;
19347 TwoLocationNameLabel->Caption =
"The following service has two or more locations with the same name without a change of\n"
19348 "direction between them. If this isn't intended then please correct it.\n\n"
19349 "Service: " + AllServices;
19379 std::ifstream InFile(FileName.c_str());
19381 int NumberOfActiveElements;
19382 bool GraphicsFollow =
false;
19384 if(InFile.is_open())
19531 if((TempString !=
"***BarriersDownVector***") && (TempString !=
"***Timetable***"))
19537 if(TempString ==
"***BarriersDownVector***")
19581 InFile.open(FileName.c_str());
19582 if(InFile.is_open())
19603 bool GraphicsFollow =
false;
19724 if((TempString !=
"***BarriersDownVector***") && (TempString !=
"***Timetable***"))
19730 if(TempString ==
"***BarriersDownVector***")
19809 InFile.get(TempChar);
19810 while(!InFile.eof() && ((TempChar ==
'\n') || (TempChar ==
'\0')))
19812 InFile.get(TempChar);
19843 double PowerDouble;
19873 AnsiString TempString =
"", Line1 =
"", Line2 =
"", Line3 =
"", Line4 =
"", Line5 =
"";
19874 char *Buffer =
new char[1000];
19877 InFile.get(TempChar);
19878 InFile.getline(Buffer, 1000);
19879 TempString = AnsiString(Buffer);
19880 while(TempString !=
"***End of performance file***")
19884 InFile.getline(Buffer, 1000);
19885 TempString = AnsiString(Buffer);
19896 AnsiString TempString =
"";
19899 InFile.get(TempChar);
19900 if(TempChar !=
'\n')
19910 while(TempString !=
"***End of performance file***")
19931 AnsiString OneLine = Text.SubString(1, Text.Pos(
'\x0D'));
19932 while((OneLine.Length() > 0) && OneLine[OneLine.Length()] <
' ')
19934 OneLine.SetLength(OneLine.Length() - 1);
19936 Text = Text.SubString(Text.Pos(
'\x0D'), Text.Length());
19937 while((Text.Length() > 0) && Text[1] <
' ')
19939 Text = Text.SubString(2, (Text.Length() - 1));
19941 OutFile << OneLine.c_str() <<
'\n';
19962 InfoPanel->Caption =
"PRE-START: Select AUTOMATIC SIGNAL ROUTE start signal, or left click points to change manually";
19966 InfoPanel->Caption =
"OPERATING: Select AUTOMATIC SIGNAL ROUTE start signal, or left click points to change manually";
19979 InfoPanel->Caption =
"PRE-START: Select PREFERRED ROUTE start signal, or left click points to change manually";
19983 InfoPanel->Caption =
"OPERATING: Select PREFERRED ROUTE start signal, or left click points to change manually";
19996 InfoPanel->Caption =
"PRE-START: Select PREFERRED ROUTE start signal, or left click points to change manually";
20000 InfoPanel->Caption =
"OPERATING: Select PREFERRED ROUTE start signal, or left click points to change manually";
20013 InfoPanel->Caption =
"PRE-START: Select UNRESTRICTED ROUTE start location, or left click points to change manually";
20017 InfoPanel->Caption =
"OPERATING: Select UNRESTRICTED ROUTE start location, or left click points to change manually";
20031 InfoPanel->Caption =
"PRE-START: Select UNRESTRICTED ROUTE start location, or left click points to change manually";
20035 InfoPanel->Caption =
"OPERATING: Select UNRESTRICTED ROUTE start location, or left click points to change manually";
20062 InfoPanel->Caption =
"Left click screen to zoom in at that position";
20067 InfoPanel->Caption =
"PAUSED: Railway state changes disabled";
20144 Screen->Cursor = TCursor(-11);
20145 AnsiString ErrorFileStr =
CurDir +
"\\errorlog.err";
20146 std::ofstream ErrorFile(ErrorFileStr.c_str());
20148 if(!(ErrorFile.fail()))
20151 int ScreenX = Mouse->CursorPos.x -
MainScreen->ClientOrigin.x;
20152 int ScreenY = Mouse->CursorPos.y -
MainScreen->ClientOrigin.y;
20153 AnsiString MouseStr =
"Posx: " + AnsiString(ScreenX) +
"; Posy: " + AnsiString(ScreenY);
20163 ErrorFile << Item.c_str() <<
'\n';
20170 ErrorFile << Item.c_str() <<
'\n';
20308 Screen->Cursor = TCursor(-2);
20325 int TempTTFileNumber = 0;
20327 while(FileExists(
CurDir +
"\\TmpTT" + AnsiString(TempTTFileNumber) +
".tmp"))
20329 TempTTFileNumber++;
20332 int InHandle = FileOpen(InFileName, fmOpenRead);
20335 while(InHandle < 0)
20337 InHandle = FileOpen(InFileName, fmOpenRead);
20342 ShowMessage(
"Failed to open timetable file, make sure it's spelled correctly, it exists and isn't open in another application");
20350 while(OutHandle < 0)
20357 ShowMessage(
"Failed to save temporary timetable file, sessions can't be saved - try again, may only be a temporary problem");
20358 FileClose(InHandle);
20363 int CountIn, CountOut;
20364 char *Buffer =
new char[10000];
20368 CountIn = FileRead(InHandle, Buffer, 10000);
20369 CountOut = FileWrite(OutHandle, Buffer, CountIn);
20370 if(CountOut != CountIn)
20372 ShowMessage(
"Error in writing to the temporary timetable file, sessions can't be saved - try again, may only be a temporary problem");
20374 FileClose(InHandle);
20375 FileClose(OutHandle);
20379 if(CountIn < 10000)
20385 FileClose(InHandle);
20386 FileClose(OutHandle);
20431 int VarElements = 0;
20432 bool NamedLocPresent =
false;
20440 throw Exception(
"Error - failed to find track element at " + AnsiString(TE.
HLoc) +
" & " + AnsiString(TE.
VLoc) +
" in SetLengths");
20449 NamedLocPresent =
true;
20454 if(SpeedLimit != -1)
20461 if(SpeedLimit != -1)
20472 if((NamedLocPresent) && (VarElements > 0) && ((Distance / VarElements) < 50))
20476 ShowMessage(
"Note: Named location elements are quite short. If they are too short the simulation might be too unrealistic.\n\nThis message will not be shown again.");
20480 if((NamedLocPresent) && (VarElements > 0) && ((Distance / VarElements) > 200))
20484 ShowMessage(
"Note: Named location elements are quite long. If they are too long the simulation might be too unrealistic.\n\nThis message will not be shown again.");
20494 if((VarElements * 20) > Distance)
20496 ShowMessage(
"Required distance is less than the minimum, will set each element to the minimum (20m)");
20497 Distance = (VarElements * 20);
20499 if(VarElements == 0)
20502 ShowMessage(
"No elements selected");
20507 int RemainingDistance = Distance, RemainingVarElements = VarElements, NextLength = RemainingDistance / VarElements;
20515 if(NextLength < 20)
20541 RemainingDistance -= NextLength;
20542 RemainingVarElements--;
20543 if(RemainingVarElements > 0)
20545 NextLength = RemainingDistance / RemainingVarElements;
20573 ShowMessage(
"Nothing to save!");
20579 SaveRailwayDialog->Filter =
"Development file (*.dev)|*.dev|Railway file (*.rly)|*.rly";
20592 Screen->Cursor = TCursor(-11);
20594 AnsiString Extension =
"";
20602 if(!(VecFile.fail()))
20630 if((LastChar ==
'y') || (LastChar ==
'Y'))
20659 ShowMessage(
"File open failed prior to save");
20664 ShowMessage(
"Can't save: extension must be either '.dev', or '.rly' with railway ready for operation");
20666 Screen->Cursor = TCursor(-2);
20700 System::WideChar ValidityBuffer[14];
20701 Clipboard()->GetTextBuf(ValidityBuffer, 14);
20703 Clipboard()->Close();
20812 bool TextFound =
false;
20837 AnsiString(VPos) +
"," + AnsiString((
short)UseEnteredPosition));
20838 int VPosHi, VPosLo, TextPosHi, TextPosLo;
20841 if(!UseEnteredPosition)
20848 int Depth = abs(Font->Height);
20849 TextPosHi = VPosHi + 20;
20850 TextPosLo = VPosLo - Depth - 4;
20853 if(TextPosLo >= ScreenPosLo)
20857 else if(TextPosHi < ScreenPosHi)
20863 VPos = ScreenPosLo + 288;
20910 catch(
const Exception &e)
20987 AnsiString OpTimeToActDisplay;
20988 AnsiString OpTimeToActString;
20989 AnsiString HeadCode;
20990 float OpTimeToActFloat;
21002 HeadCode = HCandTrainPosParam.first;
21003 if(OpTimeToActFloat < 0.25)
21005 OpTimeToActString =
"NOW";
21007 else if(OpTimeToActFloat < 1)
21009 OpTimeToActString =
"<1";
21013 OpTimeToActString = AnsiString(floor(OpTimeToActFloat));
21015 if(OpTimeToActFloat < 60)
21017 OpTimeToActDisplay = HeadCode + AnsiString(
'\t') + OpTimeToActString;
21018 OAListBox->Items->Add(OpTimeToActDisplay);
21042 TPicture *PicPtr =
new TPicture;
21044 UGME.second = PicPtr;
21055 catch(
const EInvalidGraphic &e)
21058 "Incorrect file format, the file can't be loaded.\nEnsure that the file you want is a valid graphic file with extension .bmp, .gif, .jpg, or .png");
21061 catch(
const Exception &e)
21076 std::wstringstream wss;
21079 wss <<
"RlyClpBrdCopy\n";
21083 wss <<
"RlyClpBrd_Cut\n";
21088 wss << TTVIt->SpeedTag;
21090 for(
int AnsLen = 0; AnsLen <= TTVIt->ActiveTrackElementName.Length(); AnsLen++)
21092 if((TTVIt->ActiveTrackElementName).c_str()[AnsLen] !=
'\0')
21094 wss << (TTVIt->ActiveTrackElementName).c_str()[AnsLen];
21101 for(
int AnsLen = 0; AnsLen <= TTVIt->ElementID.Length(); AnsLen++)
21103 if((TTVIt->ElementID).c_str()[AnsLen] !=
'\0')
21105 wss << (TTVIt->ElementID).c_str()[AnsLen];
21112 for(
int AnsLen = 0; AnsLen <= TTVIt->LocationName.Length(); AnsLen++)
21114 if((TTVIt->LocationName).c_str()[AnsLen] !=
'\0')
21116 wss << (TTVIt->LocationName).c_str()[AnsLen];
21123 wss << TTVIt->CallingOnSet;
21125 wss << TTVIt->LCPlotted;
21127 wss << TTVIt->TempTrackMarker01;
21129 wss << TTVIt->TempTrackMarker23;
21131 wss << TTVIt->Attribute;
21133 wss << TTVIt->Conn[0];
21135 wss << TTVIt->Conn[1];
21137 wss << TTVIt->Conn[2];
21139 wss << TTVIt->Conn[3];
21141 wss << TTVIt->ConnLinkPos[0];
21143 wss << TTVIt->ConnLinkPos[1];
21145 wss << TTVIt->ConnLinkPos[2];
21147 wss << TTVIt->ConnLinkPos[3];
21149 wss << TTVIt->HLoc;
21151 wss << TTVIt->VLoc;
21153 wss << TTVIt->Length01;
21155 wss << TTVIt->Length23;
21157 wss << TTVIt->SpeedLimit01;
21159 wss << TTVIt->SpeedLimit23;
21161 wss << TTVIt->StationEntryStopLinkPos1;
21163 wss << TTVIt->StationEntryStopLinkPos2;
21165 wss << TTVIt->TrainIDOnElement;
21167 wss << TTVIt->TrainIDOnBridgeTrackPos01;
21169 wss << TTVIt->TrainIDOnBridgeTrackPos23;
21171 wss << int(TTVIt->SigAspect);
21174 wss <<
"$$$" <<
'\n';
21180 for(
int AnsLen = 0; AnsLen <= TTVIt->TextString.Length(); AnsLen++)
21182 if((TTVIt->TextString).c_str()[AnsLen] !=
'\0')
21184 wss << (TTVIt->TextString).c_str()[AnsLen];
21191 wss << TTVIt->HPos;
21193 wss << TTVIt->VPos;
21195 for(
int AnsLen = 0; AnsLen <= AnsiString(TTVIt->Font->Name).Length(); AnsLen++)
21197 if(AnsiString(TTVIt->Font->Name).c_str()[AnsLen] !=
'\0')
21199 wss << AnsiString(TTVIt->Font->Name).c_str()[AnsLen];
21206 wss << TTVIt->Font->Size;
21208 if((TTVIt->Font->Color < 0) || (TTVIt->Font->Color > 0xFFFFFF))
21214 wss << int(TTVIt->Font->Color) <<
'\n';
21216 wss << int(TTVIt->Font->Charset) <<
'\n';
21219 wss <<
"$$$" <<
'\n';
21230 wss <<
"$$$" <<
'\n';
21239 wss << PDVIt->GetTrackVectorPosition();
21241 wss << PDVIt->GetHLoc();
21243 wss << PDVIt->GetVLoc();
21245 wss << PDVIt->GetELink();
21247 wss << PDVIt->GetELinkPos();
21249 wss << PDVIt->GetXLink();
21251 wss << PDVIt->GetXLinkPos();
21253 wss << PDVIt->GetEXNumber();
21257 wss <<
"$$$" <<
'\n';
21260 Clipboard()->Clear();
21261 Clipboard()->SetTextBuf(&(wss.str()[0]));
21262 Clipboard()->Close();
21267 catch(
const EClipboardException &e)
21273 catch(
const Exception &e)
21288 ValidResult =
false;
21289 System::WideChar *SelectVectorBuffer =
new System::WideChar[4000000];
21290 int StreamSize = 0;
21291 StreamSize = Clipboard()->GetTextBuf(SelectVectorBuffer, 4000000);
21292 Clipboard()->Clear();
21293 Clipboard()->Close();
21294 if(StreamSize < 14)
21299 std::wstringstream wss;
21300 wss << SelectVectorBuffer;
21301 ClpBrdValid = AnsiString(SelectVectorBuffer).SubString(1, 13);
21303 delete[]SelectVectorBuffer;
21310 int MarkerCounter = 0;
21312 wchar_t LineString[1000];
21317 wss.getline(LineString, 100);
21320 THVPair SelectTrackMapKeyPair;
21324 wss.getline(LineString, 100);
21325 if(AnsiString(LineString) ==
"$$$")
21332 wss.getline(LineString, 100);
21334 wss.getline(LineString, 100);
21336 wss.getline(LineString, 100);
21339 wss.getline(LineString, 100);
21341 wss.getline(LineString, 100);
21342 TE.
LCPlotted = AnsiString(LineString).ToInt();
21343 wss.getline(LineString, 100);
21345 wss.getline(LineString, 100);
21348 wss.getline(LineString, 100);
21349 TE.
Attribute = AnsiString(LineString).ToInt();
21350 wss.getline(LineString, 100);
21351 TE.
Conn[0] = AnsiString(LineString).ToInt();
21352 wss.getline(LineString, 100);
21353 TE.
Conn[1] = AnsiString(LineString).ToInt();
21354 wss.getline(LineString, 100);
21355 TE.
Conn[2] = AnsiString(LineString).ToInt();
21356 wss.getline(LineString, 100);
21357 TE.
Conn[3] = AnsiString(LineString).ToInt();
21358 wss.getline(LineString, 100);
21359 TE.
ConnLinkPos[0] = AnsiString(LineString).ToInt();
21360 wss.getline(LineString, 100);
21361 TE.
ConnLinkPos[1] = AnsiString(LineString).ToInt();
21362 wss.getline(LineString, 100);
21363 TE.
ConnLinkPos[2] = AnsiString(LineString).ToInt();
21364 wss.getline(LineString, 100);
21365 TE.
ConnLinkPos[3] = AnsiString(LineString).ToInt();
21366 wss.getline(LineString, 100);
21367 TE.
HLoc = AnsiString(LineString).ToInt();
21368 wss.getline(LineString, 100);
21369 TE.
VLoc = AnsiString(LineString).ToInt();
21370 wss.getline(LineString, 100);
21371 TE.
Length01 = AnsiString(LineString).ToInt();
21372 wss.getline(LineString, 100);
21373 TE.
Length23 = AnsiString(LineString).ToInt();
21374 wss.getline(LineString, 100);
21376 wss.getline(LineString, 100);
21378 wss.getline(LineString, 100);
21380 wss.getline(LineString, 100);
21382 wss.getline(LineString, 100);
21384 wss.getline(LineString, 100);
21386 wss.getline(LineString, 100);
21389 wss.getline(LineString, 100);
21390 int temp = AnsiString(LineString).ToInt();
21411 SelectTrackMapKeyPair.first = TE.
HLoc;
21412 SelectTrackMapKeyPair.second = TE.
VLoc;
21413 SelectTrackMapEntry.first = SelectTrackMapKeyPair;
21415 SelectTrackMap.insert(SelectTrackMapEntry);
21420 AnsiString FontName;
21421 int FontSize, FontColour, FontCharset, FontStyle;
21424 wss.getline(LineString, 1000);
21425 if(AnsiString(LineString) ==
"$$$")
21433 wss.getline(LineString, 1000);
21434 TI.
HPos = AnsiString(LineString).ToInt();
21435 wss.getline(LineString, 1000);
21436 TI.
VPos = AnsiString(LineString).ToInt();
21437 wss.getline(LineString, 1000);
21438 FontName = AnsiString(LineString).c_str();
21439 wss.getline(LineString, 1000);
21440 FontSize = AnsiString(LineString).ToInt();
21441 wss.getline(LineString, 1000);
21442 FontColour = AnsiString(LineString).ToInt();
21443 wss.getline(LineString, 1000);
21444 FontCharset = AnsiString(LineString).ToInt();
21445 wss.getline(LineString, 1000);
21446 FontStyle = AnsiString(LineString).ToInt();
21448 TFont *NewFont =
new TFont;
21449 NewFont->Name = FontName;
21450 NewFont->Size = FontSize;
21451 NewFont->Color =
static_cast<TColor
>(FontColour);
21452 NewFont->Charset = FontCharset;
21459 wss.getline(LineString, 100);
21460 SelectBitmap->Height = AnsiString(LineString).ToInt();
21461 wss.getline(LineString, 100);
21463 wss.getline(LineString, 100);
21464 SelectRect.left = AnsiString(LineString).ToInt();
21465 wss.getline(LineString, 100);
21466 SelectRect.top = AnsiString(LineString).ToInt();
21467 wss.getline(LineString, 100);
21468 if(AnsiString(LineString) ==
"$$$")
21475 int TempTVPos, TempHLoc, TempVLoc, TempELink, TempELinkPos, TempXLink, TempXLinkPos, TempEXNumber, ATVecPos;
21480 wss.getline(LineString, 100);
21481 if(AnsiString(LineString) ==
"$$$")
21487 TempTVPos = AnsiString(LineString).ToInt();
21488 wss.getline(LineString, 100);
21489 TempHLoc = AnsiString(LineString).ToInt();
21490 wss.getline(LineString, 100);
21491 TempVLoc = AnsiString(LineString).ToInt();
21492 wss.getline(LineString, 100);
21493 TempELink = AnsiString(LineString).ToInt();
21494 wss.getline(LineString, 100);
21495 TempELinkPos = AnsiString(LineString).ToInt();
21496 wss.getline(LineString, 100);
21497 TempXLink = AnsiString(LineString).ToInt();
21498 wss.getline(LineString, 100);
21499 TempXLinkPos = AnsiString(LineString).ToInt();
21500 wss.getline(LineString, 100);
21501 TempEXNumber = AnsiString(LineString).ToInt();
21510 TempPrefDirElement.
SetELink(TempELink);
21512 TempPrefDirElement.
SetXLink(TempXLink);
21519 if(MarkerCounter == 4)
21521 ValidResult =
true;
21526 catch(
const Exception &e)
21528 ValidResult =
false;